Hi, I've been experimenting the web2py services functionality. Very neat!
But what I'm wondering is whether it is possible to expose a service that
accepts arbitrary URL parameters and receives them as *args and/or
**kwargs. That is, I'd like to have code like this:
@service.json
def myfinc(this, that, *args, **kwargs):
# ...
And if I visit
myapp/default/call/json/this/that/something/else?key=foo&otherkey=bar ,
then I would get ("something", "else") in args, and {"key": "foo",
"otherkey": "bar"} in kwargs. Is such a thing possible. Looking at the
code in gluon.tools.py (specifically the "universal_caller" function), I'm
guessing no, because it doesn't seem to just silently swallow any extra
arguments that don't match with the function signature, and it doesn't
check to see whether the function accepts varargs. Has there been any
discussion about adding such a feature?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.