2 messages in com.googlegroups.pylons-discussRe: Call render function from standal...
FromSent OnAttachments
michi23 Mar 2008 00:04 
Mike Orr23 Mar 2008 11:26 
Subject:Re: Call render function from standalone script
From:Mike Orr (slug@public.gmane.org)
Date:03/23/2008 11:26:49 AM
List:com.googlegroups.pylons-discuss

On Sun, Mar 23, 2008 at 12:05 AM, michi
<muts@public.gmane.org> wrote:

Hello,

I need to call the template render() function from a standalone script. I tried what was suggested here:

http://groups.google.com/group/pylons-discuss/msg/44fc2b5973b1b6c6

but I got this error:

File "/usr/lib/python2.4/site-packages/Pylons-0.9.6.1-py2.4.egg/ pylons/templating.py", line 342, in render return pylons.buffet.render(template_name=template, fragment=fragment, File "/usr/lib/python2.4/site-packages/Paste-1.6.1dev_r34-py2.4.egg/paste/ registry.py", line 125, in __getattr__ return getattr(self._current_obj(), attr) File "/usr/lib/python2.4/site- packages/Paste-1.6.1dev_r34-py2.4.egg/paste/registry.py", line 180, in _current_obj raise TypeError(TypeError: No object (name: Buffet) has been registered for this thread

and I'm not sure where to go from here. I appreciate any input.

Thanks! --Michi

Standalone scripts are mainly used to maintain the model data. The few lines described are enough for that. But to use render() you'd have to do more.

Buffet has been replaced by simple render_mako and render_genshi functions in Pylons 0.9.7-alpha, so I wouldn't spend time fussing with it. Just create your own mako.TemplateLookup using the paths Pylons would.