[Grok-dev] template issue with WidgetTemplate of megrok.z3cform.base
Jeroen Michiel
jmichiel at yahoo.com
Fri May 13 04:45:32 EDT 2011
I'm declaring a widget template like this:
import megrok.z3cform.base as z3cform
class DictDisplayWidgetTemplate(z3cform.WidgetTemplate):
grok.context(Interface)
grok.template('widgets_templates/dict_display.pt')
z3cform.directives.widget(DictDisplayWidget)
z3cform.directives.mode(z3cform.DISPLAY_MODE)
Starting my server however results in this traceback:
File
"d:\git\qcpython\art\server\eggs\megrok.z3cform.base-0.3-py2.6.egg\megrok\z3cform\base\meta.py",
line 71, in execute
template = os.path.join(template_path, template)
File "C:\Python26\lib\ntpath.py", line 73, in join
elif isabs(b):
File "C:\Python26\lib\ntpath.py", line 58, in isabs
return s != '' and s[:1] in '/\\'
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File
"D:\Git\QCPython\ART\Server\parts\etc\site.zcml", line 4.2-4.28
ZopeXMLConfigurationError: File
"d:\git\qcpython\art\server\src\arts\configure.zcml", line 11.2-11.27
TypeError: 'in <string>' requires string as left operand, not tuple
apparently, the 'template' parameter that is given to the execute method in
megrok.z3cform.base's meta.py is a tuple containing ('arts.browser.widgets',
'widgets_templates/dict_display.pt'), and not a string.
I could solve this by adding
if isinstance(template, tuple):
template = template[1]
to megrok.z3cform.base's meta.py
However, I think I'm doing something wrong in the first place: perhaps
grok.template is not the way to do this?
--
View this message in context: http://old.nabble.com/template-issue-with-WidgetTemplate-of-megrok.z3cform.base-tp31609568p31609568.html
Sent from the Grok mailing list archive at Nabble.com.
More information about the Grok-dev
mailing list