Yes. No need of T2 or T3.
On Feb 7, 5:08 pm, Tito Garrido <[email protected]> wrote:
> Thank you Massimo!
>
> It works even without t2?
>
>
>
> On Sat, Feb 7, 2009 at 7:59 PM, mdipierro <[email protected]> wrote:
>
> > Yes. Just make a model that contains
>
> > from gluon.storage import Storage
> > settings=Storage()
> > settings.rss_procedures=[]
> > settings.exposed_procedures=[]
> > settings.xmlrpc_procedures=[]
> > settings.json_procedures=[]
> > def rss(f):
> > settings.rss_procedures.append(f.__name__)
> > return f
> > def expose(f):
> > settings.exposed_procedures.append(f.__name__)
> > return f
> > def json(f):
> > settings.json_procedures.append(f.__name__)
> > return f
> > def xmlrpc(f):
> > settings.xmlrpc_procedures.append(f.__name__)
>
> > and a controller with the following actions:
>
> > def rss():
> > if request.args and request.args[0] in settings.rss_procedures:
> > feed=eval('%s(*request.args[1:],**dict
> > (request.vars))'%request.args[0])
> > else:
> > t2._error()
> > import gluon.contrib.rss2 as rss2
> > rss = rss2.RSS2(
> > title=feed['title'],
> > link = feed['link'],
> > description = feed['description'],
> > lastBuildDate = feed['created_on'],
> > items = [
> > rss2.RSSItem(
> > title = entry['title'],
> > link = entry['link'],
> > description = entry['description'],
> > pubDate = entry['created_on']) for entry in feed
> > ['entries']]
> > )
> > response.headers['Content-Type']='application/rss+xml'
> > return rss2.dumps(rss)
>
> > 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'
>
> > def xmlrpc():
> > methods=[eval(x) for x in settings.xmlrpc_procedures]
> > return response.xmlrpc(request,methods)
>
> > def json():
> > if request.args and request.args[0] in settings.json_procedures:
> > import gluon.contrib.simplejson as sj
> > return sj.dumps(eval('%s(*request.args[1:],**dict
> > (request.vars))'%request.args[0]))
> > return 'Not Authorized'
>
> > Massimo
>
> > On Feb 7, 4:43 pm, Tito Garrido <[email protected]> wrote:
> > > Hi Folks,
>
> > > t3 have some useful decorators like @xmrpc and @json do you know if we
> > can
> > > use it without t3?
>
> > > Best Regards,
>
> > > Tito
>
> > > --
> > > Linux User #387870
> > > .........____
> > > .... _/_õ|__|
> > > ..º[ .-.___.-._| . . . .
> > > .__( o)__( o).:_______
>
> --
> Linux User #387870
> .........____
> .... _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:_______
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---