I think this is related to ticket 148:

http://trac.turbogears.org/turbogears/ticket/148

Ciao
Michele

Kevin Dangoor wrote:
> I believe that this is expecting an actual template class or name of
> the template, which is moderately inconvenient.
>
> Can you open a trac ticket to make this accept a string template as well?
>
> Kevin
>
> On 12/20/05, Dan Jacob <[EMAIL PROTECTED]> wrote:
> >
> > When I add a custom template in a constructor I get the following
> > error:
> >
> > my_template="""
> > <form xmlns:py="http://purl.org/kid/ns#"; name="${widget.name}"
> >       action="${getattr(self, 'action', None)}" method="${getattr(self,
> > 'method', 'post')}"
> >       enctype="${getattr(self, 'enctype', None)}">
> >     <div py:for="widget in widgets" py:if="widget.hidden"
> > py:strip="True">
> >        ${widget.insert(getattr(self.widget_value, widget.name, None),
> > input_values, widget_error.get(widget.name, None))}
> >     </div>
> >     <table border="0">
> >     <tr py:for="widget in widgets" py:if="not widget.hidden">
> >             <td>
> >                 <span py:if="widget.label and widget.labeltext"
> >
> > py:replace="widget.label.insert(widget.labeltext)"/>
> >                 <span py:if="not widget.label or not widget.labeltext"
> > py:strip="True">&#160;</span>
> >             </td>
> >             <td>${widget.insert(getattr(self.widget_value, widget.name,
> > None), input_values, widget_error.get(widget.name, None))}</td>
> >         </tr>
> >          <tr>
> >             <td>&#160;</td>
> >             <td>${submit.insert(submittext)}</td>
> >         </tr>
> >     </table>
> > </form>
> > """
> >
> > my_form=TableForm(widgets=[...], template=my_template)
> >
> > Error:
> >
> > Traceback (most recent call last):
> >   File
> > "c:\python24\lib\site-packages\CherryPy-2.1.0-py2.4.egg\cherrypy\_cphttptools.py",
> > line 271, in run
> >     main()
> >   File
> > "c:\python24\lib\site-packages\CherryPy-2.1.0-py2.4.egg\cherrypy\_cphttptools.py",
> > line 502, in main
> >     body = page_handler(*args, **cherrypy.request.paramMap)
> >   File "c:\turbogears\turbogears\controllers.py", line 196, in newfunc
> >     html, *args, **kw)
> >   File "c:\turbogears\turbogears\database.py", line 174, in
> > run_with_transaction
> >     retval = func(*args, **kw)
> >   File "c:\turbogears\turbogears\controllers.py", line 225, in
> > _execute_func
> >     return _process_output(tg_format, output, html)
> >   File "c:\turbogears\turbogears\controllers.py", line 60, in
> > _process_output
> >     output = view.render(output, tg_format, template=template)
> >   File "c:\turbogears\turbogears\view.py", line 107, in render
> >     return t.serialize(encoding=defaultencoding, output=format,
> > fragment=fragment)
> >   File
> > "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\__init__.py", line
> > 232, in serialize
> >     return serializer.serialize(self, encoding, fragment)
> >   File
> > "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\serialization.py",
> > line 51, in serialize
> >     text = list(self.generate(stream, encoding, fragment))
> >   File
> > "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\serialization.py",
> > line 319, in generate
> >     for ev, item in self.apply_filters(stream):
> >   File
> > "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\serialization.py",
> > line 77, in balancing_filter
> >     for ev, item in stream:
> >   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> > line 203, in _coalesce
> >     for ev, item in stream:
> >   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\filter.py",
> > line 21, in transform_filter
> >     for ev, item in apply_matches(stream, template, templates,
> > apply_func):
> >   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\filter.py",
> > line 31, in apply_matches
> >     item = stream.expand()
> >   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> > line 95, in expand
> >     for ev, item in self._iter:
> >   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> > line 164, in _track
> >     for p in stream:
> >   File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
> > line 203, in _coalesce
> >     for ev, item in stream:
> >   File "C:\projects\xmlvalidator\xmlvalidator\templates\index.py", line
> > 74, in _pull
> >   File "c:\turbogears\turbogears\widgets\base.py", line 111, in insert
> >     self.template)
> >   File "c:\turbogears\turbogears\view.py", line 113, in transform
> >     tclass = lookupTemplate(template)
> >   File "c:\turbogears\turbogears\view.py", line 62, in lookupTemplate
> >     tfile = pkg_resources.resource_filename(package, "%s.kid" %
> > basename)
> >   File
> > "c:\python24\lib\site-packages\setuptools-0.6a8-py2.4.egg\pkg_resources.py",
> > line 676, in resource_filename
> >     return get_provider(package_or_requirement).get_resource_filename(
> >   File
> > "c:\python24\lib\site-packages\setuptools-0.6a8-py2.4.egg\pkg_resources.py",
> > line 119, in get_provider
> >     __import__(moduleOrReq)
> > ImportError: No module named
> > <form xmlns:py="http://purl.org/kid/ns#"; name="${widget.name}"
> >       action="${getattr(self, 'action', None)}" method="${getattr(self,
> > 'method', 'post')}"
> >       enctype="${getattr(self, 'enctype', N
> >
> >
>
>
> --
> Kevin Dangoor
> Author of the Zesty News RSS newsreader
>
> email: [EMAIL PROTECTED]
> company: http://www.BlazingThings.com
> blog: http://www.BlueSkyOnMars.com

Reply via email to