[web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-07 Thread Ryan Seto
For future reference, this has been resolved with revision a1619d2857e5 in the mercurial repository. As mentioned before, simply include just the gluon/template.py file from web2py, then use it similar to the following example. example.py ~ from template import render renderedText = render(

[web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Massimo Di Pierro
somebody email me the patch. :-) On Jun 6, 1:26 pm, Thadeus Burgess wrote: > What you have looked good. The exception looks like its pandocs fault not > the template system. > > -- > Thadeus > > > > > > > > On Mon, Jun 6, 2011 at 1:03 PM, Ryan Seto wrote: > > I see. > > > Would you like me to tr

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Ryan Seto
If you could, let me try and get my solution to work. When I'm done, should I post a patch here in the group or should I email it directly to you? On Mon, Jun 6, 2011 at 2:26 PM, Thadeus Burgess wrote: > What you have looked good. The exception looks like its pandocs fault not > the template sys

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Thadeus Burgess
What you have looked good. The exception looks like its pandocs fault not the template system. -- Thadeus On Mon, Jun 6, 2011 at 1:03 PM, Ryan Seto wrote: > I see. > > Would you like me to try and come up with a patch for this? > > On Mon, Jun 6, 2011 at 1:53 PM, Thadeus Burgess > wrote: >

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Ryan Seto
I see. Would you like me to try and come up with a patch for this? On Mon, Jun 6, 2011 at 1:53 PM, Thadeus Burgess wrote: > Yes.. > > You need some sort of response class that has a .write method... this can be > a hacked up cStringIO or other. > > Alternatively you can perform the same thing ma

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Thadeus Burgess
Yes.. You need some sort of response class that has a .write method... this can be a hacked up cStringIO or other. Alternatively you can perform the same thing manually by passing in writer, which instead of the template engine writing ``response.write("%s")`` it could write whatever you want as

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Ryan Seto
Hm, that doesn't seem to be it either. I don't get a requirement for the globals module, but what I get back is this: ~ >>> print parse_template('view.html', path='templates', >>> context=dict(content='test')) response.write(content) response.write('\r\n', escape=False) ~ Am I supposed

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-06 Thread Thadeus Burgess
What you really want is template.parse_template. Still requires restricted but only for the exception raising. Very simple. from template import parse_template print parse_template('main.html', path='/path/to/custom/views/', context=dict()) -- Thadeus On Mon, Jun 6, 2011 at 12:55 AM, Massim

[web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-05 Thread Massimo Di Pierro
It is LGPL not GPL. very different. ;-) On Jun 6, 12:36 am, Karel Antonio Verdecia Ortiz wrote: > Hi, > > I've been using the web2py template engine for a while. I don't remember > if I had to make some change to the template.py module nor the version > of the web2py this module comes from so I a

Re: [web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-05 Thread Karel Antonio Verdecia Ortiz
Hi, I've been using the web2py template engine for a while. I don't remember if I had to make some change to the template.py module nor the version of the web2py this module comes from so I attach it in this email. This was the way I could make it work (there is probably a simpler one):

[web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-05 Thread Ryan Seto
Thanks! That does solve the import restricted dependency. The import globals for the Response() object is still an issue. I tried fiddling with my copy to build a mock Response() object if we can't import globals. This is what I have so far: gluon/template.py | line 867 ~ # Here to avoi

[web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-05 Thread Massimo Di Pierro
check trunk. I removed it. I am sure we can do better. On Jun 5, 2011, at 9:26 PM, Ryan Seto wrote: > Thank you very much for your prompt response. > > It looks like the file gluon/template.py does pull in some extra > dependencies, however. > > It tries to import restricted on line 20 and impo

[web2py] Re: Using web2py's view/template engine in a standalone application

2011-06-05 Thread Ryan Seto
Thank you very much for your prompt response. It looks like the file gluon/template.py does pull in some extra dependencies, however. It tries to import restricted on line 20 and import globals on line 863. The restricted module dependency may be easy to remove, since it appears that it only use