Can i use a python keywords as parameter names?

Asked by armonge

I'm using Ladon to implement a SOAP service based on an existing wsdl. One of the methods exposed by this service looks like

<message name="listaNegraRequest">
  <part name="movil" type="xsd:string" />
  <part name="accion" type="xsd:string" />
  <part name="pass" type="xsd:string" />
</message>

Which i believe would be represented by a callable like:

@ladonize(PORTABLE_STRING, int, PORTABLE_STRING, rtype=list)
    def listaNegra(self, movil, accion, pass_, **kwargs):
        ...

However i can't user "pass" as a parameter because it's a python keyword. Is there any support for something like this?. If there isn't, where should i hack to add support for this?

In rpclib there is _type_info
http://arskom.github.com/rpclib/faq.html?highlight=named#how-do-i-use-variable-names-that-are-also-python-keywords

Cheers

Question information

Language:
English Edit question
Status:
Solved
For:
ladon Edit question
Assignee:
No assignee Edit question
Solved by:
armonge
Solved:
Last query:
Last reply:
Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#1

I'm afraid not, but it wouldn't be that hard to add though, cause Ladon has a dictionary type-definition feature where such a name-mangling thingy could be implemented.
I will put it on the todo-list.

So I guess for now you will have to choose between performance or getting the parameter names right ;-)

Best Regards
Jakob Simon-Gaarde

Revision history for this message
armonge (armonge) said :
#2

Hi, thanks for your kind help

I made a little fork to add this and a simple patch in:

 https://github.com/armonge/ladon-python/blob/master/src/ladon/ladonizer/collection.py#L329

It doesn't have any unttests or anything but works for me. Also i used github because I don't really know how to bzr

Best Regards
Andrés Reyes Monge