ladonize requires rtype

Asked by Chuck Wegrzyn on 2012-01-26

It seems ladonize() requires the presence of 'rtype' even if the function doesn't return anything. As I recall, in gSOAP and soaplib it is possible to have a function not return anything. I tried this in ladon and it didn't work.

I ought to be able to go something like

@ladonize()
def shutdown(self):
 pass

and have it work correctly.

Added:

It seems, on first glance, the changes necessary are the following (I am certain there is one last piece having to do with really encoding the output stream):

a) In decorator.py change the following:

   # Check the return type
   if not validate_type(lmi._rtype,res):
    # Raise Arg-type mismatch
    raise ReturnTypeMismatch(lmi.sinfo,lmi._func_name,lmi._rtype,type(res))

to something like:

   # Check the return type
   if lni._rtype and not validate_type(lmi._rtype,res):
    # Raise Arg-type mismatch
    raise ReturnTypeMismatch(lmi.sinfo,lmi._func_name,lmi._rtype,type(res))

2) collection.py change

  try:
   self._rtype = def_kw['rtype']
  except KeyError as ke:
   # return type must be specified.
   raise ReturnTypeUndefined(sinfo,self._func_name)

to something like:

              self._rtype = def_kw.get("rtype",None)

You could also add a check in decorator.py to make sure for functions that don't have a rtype they really return None.

Question information

Language:
English Edit question
Status:
Answered
For:
ladon Edit question
Assignee:
No assignee Edit question
Last query:
2012-01-26
Last reply:
2012-01-26
jsgaarde (jakob-simon-gaarde) said : #1

Hi Chuck.

It can be implemented, I just don't see it as an important feature, you can always just return an empty string or an int.
For SOAP requests it means 18 more bytes to send "<result>0</result>" compared with the size of the whole envelope+http headers. So in terms of efficiency the ability to send void results is insignifikant.

I have put it on the todo-list. If you can give me an example where the ability to send void results has great importans I will move it up the prioritylist :-)

Best Regards
Jakob Simon-Gaarde

Can you help with this problem?

Provide an answer of your own, or ask Chuck Wegrzyn for more information if necessary.

To post a message you must log in.