A new problem has arised,

I have a TG scheduler running a task that mails users every so often,
I wanted to use genshi to format the emails properly.

However render.render is looking for the request (which obviously
doesn't exist in a cron job) so it breaks.

What should I do? Is there an alternative method to rendering genshi
in tg?

  File "/home/project/web/project/project/lib/utils.py", line 323, in
render_email
    rendered_cnt = render(params, 'genshi', 'project.templates.emails.
%s' % tmpl)
  File "/home/project/project-env/local/lib/python2.7/site-packages/
TurboGears2-2.1.
3-py2.7.egg/tg/render.py", line 208, in render
    tg_vars = _get_tg_vars()
  File "/home/project/project-env/local/lib/python2.7/site-packages/
TurboGears2-2.1.
3-py2.7.egg/tg/render.py", line 153, in _get_tg_vars
    identity = request.environ.get('repoze.who.identity'),
  File "/home/project/project-env/local/lib/python2.7/site-packages/
Paste-1.7.5.1-
py
2.7.egg/paste/registry.py", line 137, in __getattr__
    return getattr(self._current_obj(), attr)
  File "/home/project/project-env/local/lib/python2.7/site-packages/
Paste-1.7.5.1-
py
2.7.egg/paste/registry.py", line 197, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: request) has been registered for this
thread


On Dec 26, 8:18 pm, Rotem Tamir <[email protected]> wrote:
> Alessandro,
>
> Thanks, worked like a charm :)
>
> Rotem
>
> On Dec 11, 6:49 pm, Alessandro Molina <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > Uhm, is it render_genshi used inside your code?
>
> > If that is the case, please take in mind that the renderers should not
> > be accessed directly, render_genshi function has been removed in one
> > of the latest releases.
>
> > Torendera genshi template you should use tg.render.render({},
> > 'genshi', 'myapp.template.whatever')
>
> > On Sun, Dec 11, 2011 at 5:21 PM, Rotem Tamir <[email protected]> wrote:
> > > Hi all,
>
> > > I'm just installing a new TG2.1 app on a fresh new Ubuntu server.
>
> > > Finished installing everything went great but when I tried:
>
> > > paster serve --reload development.ini
>
> > > I got this error
>
> > > from tg.renderimport render_genshi
> > > ImportError: cannot import name render_genshi
>
> > > Seems like this is standard and should work out of the box, what am I
> > > missing?
>
> > > rotem
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "TurboGears" 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 
> > > athttp://groups.google.com/group/turbogears?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to