This is not the right way to use web2py view but there is a html.py package 
that converts table and list to html automatically. I am trying to use that 
to see if it works out in web2py. More for an experiment than 
anything. This question may be more of a python question than web2py but 
here it is:

In web2py controller I have category defined (This is an example from 
reddit clone that Massimo presented)



*def categories():    categories = 
dbOBJECT(dbOBJECT.category).select(orderby=dbOBJECT.category.name 
<http://dbobject.category.name/>)    return locals()*

In the view when I do the following it display the categories (since its 
same as response.write) :

{{=categories}}

I can see the following in html (see below). does someone know how would I 
save that categories in a variable in the view (.html page) to create a 
table variable? '

Lets say save it in variable = ['Entertainment', 'News', 'Sports'] without 
using for loops {{from category in categories}}? Any example you can point 
me to?

*category.id* <http://category.id/>*category.name* <http://category.name/>1
Entertainment2News3

Sports     


The idea would be to cat few of these tables together and use HTML.table 
(variable) to display in the view without ever to use html syntax. Not sure 
if its possible and probably not recommended, but wanted to try for fun.


-- 
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.

Reply via email to