If you want to use the template system or the DAL from any python
program (now web2py):
1) make sure web2py/ is in path
2) HOW TO DAL:
from gluon.sql import DAL, Field
db=DAL('sqlite://storage',folder='/path/to/a/file/where/to/store/
db')
db.define_table(...)
... etc etc
3) HOW TO templates:
from gluon.template import render
page = render(content="{{for i in range(n):}}Hello
{{pass}}",context=dict(n=5))
print page
instead of content you can pass a stream
page = render(stream=open('myview.html','rb'),context=dict(n=5))
or a filename
page = render(filename='myview.html',context=dict(n=5))
If the template contains a {{import...}} or {{extend...}} you should
also pass a path
page = render(...., path='./')
telling web2py where to look for included and extended files.
If you try any of these please let us know.
Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---