Hi Michele..
What blodearnes is talking about this kind of problem:
<python shell>
>>> from turbogears.widgets import *
>>> hello = TextField('hello')
>>> hello.render()
Traceback (most recent call last):
File "<pyshell#7>", line 1, in -toplevel-
hello.render()
File "D:\Turbogears1.0\turbogears\widgets\base.py", line 234, in render
elem = self.display(value, **params)
File "D:\Turbogears1.0\turbogears\widgets\meta.py", line 107, in lockwidget
output = self.__class__.display(self, *args, **kw)
File "D:\Turbogears1.0\turbogears\widgets\forms.py", line 51, in _update_path
returnval = func(self, *args, **kw)
File "D:\Turbogears1.0\turbogears\widgets\forms.py", line 225, in display
return super(InputWidget, self).display(value, **params)
File "D:\Turbogears1.0\turbogears\widgets\base.py", line 226, in display
return view.engines.get('kid').transform(params, self.template_c)
AttributeError: 'NoneType' object has no attribute 'transform'
>>>
</python shell>
See also:
http://groups.google.com/group/turbogears/browse_thread/thread/00134fe24706d991
Cheers,
Roger
On 8/3/06, Michele Cella <[EMAIL PROTECTED]> wrote:
>
> I may miss something but actually TG internal widgets are kid only but
> you should be able to get use a different template language as long as
> it provides the template plugin.
>
> For example:
>
> class MyWidget(Widget):
> template = "stan:path.to.template"
>
> Ciao
> Michele
>
> [EMAIL PROTECTED] wrote:
> > Heya guys.
> >
> > r1686:
> >
> > Index: branches/1.0/turbogears/widgets/base.py
> > ===================================================================
> > --- branches/1.0/turbogears/widgets/base.py (revision 1549)
> > +++ branches/1.0/turbogears/widgets/base.py (revision 1686)
> > @@ -224,5 +224,5 @@
> > # update_data has been deprecated
> > self.update_data(params)
> > - return view.transform(params, template=self.template_c)
> > + return view.engines.get('kid').transform(params,
> > self.template_c)
> >
> > Makes sense to me as widgets are kid-only.
> >
> > However, the engines are usually lazily loaded upon the first call to
> > view.transform (via _choose_engine). So as long as your app calls
> > view.transform before a widget's display method is called, you're ok,
> > as the engines will be loaded.
> >
> > However for simple widgets tests, view.transform is not called first,
> > just the widgets display method. Thus view.engines is unpopulated,
> > view.engines.get('kid') returns None and an exception is thrown.
> >
> > I'm not sure of the best way to fix this.
> >
> > Is there a particular advantages to engines being lazily loaded? Can we
> > explicitly load them at module import? Or would it be better to add a
> > public function to get an specific engine that calls _load_engines?
> >
> > Shall I open a ticket?
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk
-~----------~----~----~----~------~----~------~--~---