Hi Sean, this is a know issue with kid:
http://www.kid-templating.org/trac/ticket/145 hopefully it will be fixed shortly. Basically you can't use py:strip on the very first tag. Ciao Michele Sean Jamieson wrote: > I'm trying to create a very simple widget to represent a menu box with > links. Theoretically this should have been fairly straight forward, but > I'm getting an error that doesn't seem to be caused by my widget or > template. > Here is the error, as generated by ipython: > > /var/www/Test-Site/<console> > > /usr/lib/python2.4/site-packages/TurboGears-0.9a4-py2.4.egg/turbogears/widgets/base.py > in display(self, value, convert, **template_vars) > 156 template_vars["value"] = > to_unicode(self.adjust_value(value, convert)) > 157 self.update_data(template_vars) > --> 158 return view.transform(template_vars, > template=self.template_c) > 159 > 160 def retrieve_javascript(self): > > /usr/lib/python2.4/site-packages/TurboGears-0.9a4-py2.4.egg/turbogears/view/base.py > in transform(info, template) > 134 "Create ElementTree representation of the output" > 135 engine, template, enginename = _choose_engine(template) > --> 136 return engine.transform(info, template) > 137 > 138 def loadBaseTemplates(): > > /usr/lib/python2.4/site-packages/TurboKid-0.9.3-py2.4.egg/turbokid/kidsupport.py > in transform(self, info, template) > 168 options = self.options > 169 if options.get("kid.i18n.runTemplateFilter", False): > 170 t._filters+=[options.get("kid.i18n_filter")] > --> 171 return ElementStream(t.transform()).expand() > 172 > > /usr/lib/python2.4/site-packages/kid-0.9-py2.4.egg/kid/pull.py in > expand(self) > 109 last.tail = item > 110 else: > --> 111 current.text = item > 112 if isinstance(last, list): > 113 return last[0] > > AttributeError: 'list' object has no attribute 'text' > > > I don't know what 'current' is, or why it's a list here. This seems to > be something wrong with the internals of kid. But it certanly happens > when I do menu.render() or menu.display(). > > I get this same error from the running application, or from console, > console backtrace is much shorter since I call menu.display() directly, > but the last few bits are the same. > > My widget is simply this: > > class MenuBlock( widgets.Widget ): > params = ( 'title', 'links' ) > template = ''' > <menu py:strip="True" xmlns:py="http://purl.org/kid/ns#"> > <div class="title">$title</div> > <div class="body" py:for="link in links"> > <a href="${link[0]}">${link[1]}</a> > <span py:if="len(link) > 2">${link[2]}</span> > </div> > </menu> > ''' > > And it's used in the master.kid file as: > <div id="menu"> > <div class="block" py:for="menu in view.menu"> > ${menu.display()} > </div> > </div> > > > Thanks in advance for any help, > Sean --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

