I added some more examples here: http://www.web2py.com/examples/default/tools#services
On 27 Apr, 21:05, mdipierro <[email protected]> wrote: > I deleted that page because it is misleading and old. There are two > issues: > > 1) the technical reason for your error is that > > @f > def g(): return 'something' > > is equivalent to > > def g(): return 'something' > g=f(g()) > > and in your case f (i.e. run) does not take arguments. > > 2) anyway the post is misleading because this is all already coded for > you and part of web2py core functionality. Here is a complete example > you can put in your controller > > ### begin > from gluon.tools import Service > service=Service(globals()) > > @service.run > @service.json > def create(name): return name > > def call(): return service() > ### end > > now > visithttp://..../call/run/create/Davehttp://..../call/run/create?name=Davehttp://..../call/json/create/Davehttp://..../call/json/create?name=Dave > > same for xmlrpc, pyamf, etc. This is documented partially in the gluon/ > tools file. > > Massimo > > On 27 Apr, 20:30, Dave <[email protected]> wrote: > > > Hello, > > I'm following the steps given on AlterEgo to define fancy decorators. > > (http://mdp.cti.depaul.edu/AlterEgo/default/show/204). I'm only > > exposing procedures through run and am getting a TypeError. > > > Here's the code in my model: > > from gluon.storage import Storage > > settings=Storage() > > settings.exposed_procedures=[] > > > def expose(f): > > settings.exposed_procedures.append(f.__name__) > > return f > > > And the code in my controller: > > def run(): > > if request.args and request.args[0] in > > settings.exposed_procedures: > > return eval('%s(*request.args[1:],**dict > > (request.vars))'%request.args[0]) > > return 'Not Authorized' > > > @run > > def create(name): > > print name > > > I appreciate any feedback on this typeerror. Also, can I assume this > > should work the same way service decorators do? Is there any > > advantage? > > > Thanks, > > Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

