It is very simple actually. If you call any action now you add an
extension (for example .xxx).

If there is extension instead of looking for a view ending in .html it
looks for a view with the extension you requested. If it does not find
it it will try a generic view with the extension you requested and if
it not find that either it returns HTTP(405).

the latest welcome app ships with generic.json, generic.xml,
generic.rss.

the only special one here is generic.rss because for it to work the
action must return a dictionary containing a title, link, description,
items. The other two can serialize the output of any action.

Just try and it should be obvious. It requires no programming unless
you want to extend to support different protocols.

Massimo

On May 22, 9:18 am, Jason Brower <[email protected]> wrote:
> Can we please have someone document this, I would love to have a less,
> well, terse example.
> Nothing wrong with your explanation, I just like a more tutorial styled
> instruction set. :D
> Regards,
> Jason
>
> On Fri, 2009-05-22 at 05:54 -0700, mdipierro wrote:
> > - download trunk
> > - Create a new app
> > - make sure you see the new views/generic.* files in the new app or
> > something is wrong
>
> > - edit default.py and create an action:
>
> > def test():
> >     return dict(title='title1',link='link',description='description',
> >                 items=[dict
> > (title='title2',link='link',description='description'),
> >                        dict
> > (title='title3',link='link',description='description'),
> >                        dict
> > (title='title4',link='link',description='description')])
>
> > (there is nothing special here, just an example) now call it in the
> > usual way
>
> >  http://.../test
>
> > but also try
>
> >  http://.../test.html
> >  http://.../test.xml
> >  http://.../test.json
> >  http://.../test.rss
>
> > Notice there is nothing you need to do. It should just work.
>
> > Massimo
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to