I've put some time into this, step to reproduce te problem.
Let's put this widget into my controllers.py:
class MyTextField(widgets.TextField):
template = """
<div xmlns:py="http://purl.org/kid/ns#">
</div>
"""
I then modified turbogears/widgets/base.py to:
if isinstance(t, basestring) and "<" in t:
modname = "%s.%s.Template" % (cls.__module__, name)
print modname <- addition
cls.template = kid.load_template(t, name=modname).Template
starting the application gives me a loop that prints this:
...
turbogears.widgets.base.CalendarDateTimePicker.Template
turbogears.widgets.base.AutoCompleteField.Template
turbogears.widgets.forms.TableForm.Template
turbogears.fastdata.datacontroller.DataGrid.Template
playground.controllers.MyTextField.Template
2005/12/29 13:45:08 HTTP INFO SystemExit raised: shutting down
autoreloader
2005/12/29 13:45:08 HTTP INFO CherryPy shut down
Unhandled exception in thread started by
Error in sys.excepthook:
The problem is related to widgets that provide a source string as
template, in base.py they are loaded with a module name to be then
rendered using turbogears kidsupport:
if isinstance(t, basestring) and "<" in t:
modname = "%s.%s.Template" % (cls.__module__, name)
cls.template = kid.load_template(t, name=modname).Template
inside kidsupport they are autoreloaded if needed but since they aren't
standalone kid files the autoreloader can't find them and raises an
exception.
The solution is to bypass the reloading mechanism in this case (it will
work anyway since they are inside our python files), I'm trying to do
it but I'm not a big expert so, I'm sure it's pretty trivial.
Maybe we can mark those modules with a source part to bypass them
inside kidsupport:
modname = "%s.%s.source.Template" % (cls.__module__, name)
Ciao
Michele
Kevin Dangoor wrote:
> This may indeed be #148. I'm having trouble reproducing it...
>
> I didn't have the static directory set up properly at first, but that
> didn't crash CP as described. Then, when I did set the static
> directory up properly, the widget worked fine. I stuck it in a random
> 20 minute wiki project that I've got, and all was well...
>
> Kevin
>
> On 12/29/05, Michele Cella <[EMAIL PROTECTED]> wrote:
> >
> > This also seems to be related to ticket #148, you are using a widget
> > created outside the turbogears package, right?
> >
> > Ciao
> > Michele
> >
> > reflog wrote:
> > > hm, ok.
> > > i'll keep an eye on it.
> > >
> > > eli
> >
> >
>
>
> --
> Kevin Dangoor
> Author of the Zesty News RSS newsreader
>
> email: [EMAIL PROTECTED]
> company: http://www.BlazingThings.com
> blog: http://www.BlueSkyOnMars.com