As for the getattr(), the following error is thrown:
Page handler: <bound method Root.index of <useplex.controllers.Root object at 0xb76585ec>>
Traceback (most recent call last):
File "/home/nicky/TG1/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
self.main()
File "/home/nicky/TG1/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in index
File "/home/nicky/src/turbogears/turbogears/controllers.py", line 281, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "/home/nicky/src/turbogears/turbogears/database.py", line 245, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/home/nicky/src/turbogears/turbogears/controllers.py", line 298, in <lambda>
mapping, fragment, *args, **kw)))
File "/home/nicky/src/turbogears/turbogears/controllers.py", line 332, in _execute_func
return _process_output(output, template, format, content_type, mapping, fragment)
File "/home/nicky/src/turbogears/turbogears/controllers.py", line 73, in _process_output
mapping=mapping, content_type=content_type,fragment=fragment)
File "/home/nicky/src/turbogears/turbogears/view/base.py", line 127, in render
return turbogears.util.adapt_call(engine.render, **dict(info=info, format=format, fragment=fragment, template=template, mapping=mapping))
File "/home/nicky/src/turbogears/turbogears/util.py", line 161, in adapt_call
return func(*args, **kw)
File "/home/nicky/TG1/lib/python2.4/site-packages/TurboCheetah-0.9.5-py2.4.egg/turbocheetah/cheetahsupport.py", line 107, in render
return str(tempobj)
File "/home/nicky/python/useplex/useplex/templates/SiteTemplate.py", line 251, in respond
self.pagecontent(trans=trans)
File "<string>", line 124, in pagecontent
NameError: global name 'aWidget' is not defined
On 7/20/06, Christopher Arndt <[EMAIL PROTECTED]> wrote:
Hi,
[EMAIL PROTECTED] wrote:
> First off, thanks to Christopher Arndt for the following doc:
>
> Templates for using TurboCheetah with TurboGears
> http://trac.turbogears.org/turbogears/wiki/TurboCheetahTemplates
It's nice to hear that somebody found this useful :-)
> I pass in aWidget, which is enough to trigger the set up of the JS and
> CSS entities. However, I don't know how to set up the cheetah template
> such that I can invoke the render() method on the widget within the
> template. To get around this I simply pass the xml string as well.
>
> Does any one know how to change the template so that I can do something
> like ${aWidget.render()} instead of passing in the xml string as well?
Normally ${aWidget.render()} should work, but the autocalling feature of
the Cheetah namemapper seems to get in the way here. I think this is a
bug and have brought it up on the Cheetah mailing list*, but did not get
a reply yet.
You can work around it using either of the two following syntax forms:
${getattr(aWidget, 'render')()}
or
${getVar('aWidget.render', autoCall=False)()}
Chris
* http://sourceforge.net/mailarchive/message.php?msg_id=30070548
G-Mail Account
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [TurboGears] Re: TurboCheetah template access to widgets... Nicky Ayoub
- [TurboGears] Re: TurboCheetah template access to wi... Christopher Arndt
- [TurboGears] Re: TurboCheetah template access to wi... Jorge Vargas

