packing
The packing module is accessible via the wareweb module.
Functions
f unpack(func) ...
Unpacks self.path_parts and self.fields into a function call; this decorator can be used to turn such a method into a zero-argument method that unpacks those arguments.
Arguments can have _path on the end of their name, in which case they are unpacked from the path. Also variable arguments like *args will be unpacked from the path.
Other arguments can have _int, _list, _float, and _req appended. These each do a convertion -- _int to integer, _float to floating point numbers, _list will make sure it is a list of items (and without this it cannot be a list!), _req that it is not empty. A bad conversion will cause an HTTPBadRequest exception to be raised (this is not meant to be used for validation of user input, only for passing information back that came from the server).
Note that the argument extensions shouldn't go in the HTTP variables, they are only present in the function signature.
f unpack_xmlrpc(func) ...
Unpacks an XMLRPC request into a function call, and packs the response into a XMLRPC response.
f unpack_json(func) ...
Unpack a JSON request into a function call, and pack the return value into a JSON response.
@@: Should this always create a JSON response? Should there be a decorator to give a JSON response without a JSON request?
See the source for more information.