I've done a patch for this problem in turbokid, but it's the old version of the patch that was used by kevin (because I can't remove older attachment in trac).

http://trac.turbogears.org/turbogears/attachment/ticket/403/turbokid-elt.patch

Jason Chu a écrit :
On Sat, Feb 11, 2006 at 12:16:48AM -0000, Michele Cella wrote:


Jason Chu wrote:

Working with the new widget code some more...

Something I've noticed while converting all our widgets, if you have a
widget who's outermost tab has a py:strip in it (this is also the tag
that has the xmlns:py in it), you will get a trackback that looks
something like this:

Traceback (most recent call last):
 File 
"/home/jchu/coding/turbogears/thirdparty/cherrypy/cherrypy/_cphttptools.py", 
line 99, in _run
   self.main()
 File 
"/home/jchu/coding/turbogears/thirdparty/cherrypy/cherrypy/_cphttptools.py", 
line 247, in main
   body = page_handler(*virtual_path, **self.params)
 File "<string>", line 3, in month
 File "/home/jchu/coding/turbogears/turbogears/controllers.py", line 199, in 
expose
   func, tg_format, html, fragment, *args, **kw)
 File "/home/jchu/coding/turbogears/turbogears/database.py", line 193, in 
run_with_transaction
   retval = func(*args, **kw)
 File "/home/jchu/coding/turbogears/turbogears/controllers.py", line 220, in 
_execute_func
   return _process_output(tg_format, output, html, fragment)
 File "/home/jchu/coding/turbogears/turbogears/controllers.py", line 71, in 
_process_output
   fragment=fragment)
 File "/home/jchu/coding/turbogears/turbogears/view.py", line 60, in render
   return engine.render(info, format, fragment, template)
 File "/home/jchu/coding/turbogears/plugins/kid/turbokid/kidsupport.py", line 
97, in render
   return t.serialize(encoding=self.defaultencoding, output=format, 
fragment=fragment)
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/__init__.py", line 236, 
in serialize
   return serializer.serialize(self, encoding, fragment)
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/serialization.py", line 
51, in serialize
   text = list(self.generate(stream, encoding, fragment))
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/serialization.py", line 
327, in generate
   for ev, item in self.apply_filters(stream):
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/pull.py", line 206, in 
_coalesce
   for ev, item in stream:
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/filter.py", line 21, in 
transform_filter
   for ev, item in apply_matches(stream, template, templates, apply_func):
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/filter.py", line 31, in 
apply_matches
   item = stream.expand()
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/pull.py", line 95, in 
expand
   for ev, item in self._iter:
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/pull.py", line 164, in 
_track
   for p in stream:
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/pull.py", line 206, in 
_coalesce
   for ev, item in stream:
 File "/home/jchu/coding/fatboy/fatboy/templates/calendar/month.py", line 224, 
in _pull
   yield (START, current)
 File "/home/jchu/coding/turbogears/turbogears/widgets/base.py", line 39, in 
lockwidget
   output = self.__class__.display(self, *args, **kw)
 File "/home/jchu/coding/turbogears/turbogears/widgets/base.py", line 176, in 
display
   return view.transform(template_vars, template=self.template_c)
 File "/home/jchu/coding/turbogears/turbogears/view.py", line 65, in transform
   return engine.transform(info, template)
 File "/home/jchu/coding/turbogears/plugins/kid/turbokid/kidsupport.py", line 
114, in transform
   return ElementStream(t.transform()).expand()
 File "/home/jchu/coding/turbogears/thirdparty/kid/kid/pull.py", line 111, in 
expand
   current.text = item
AttributeError: 'list' object has no attribute 'text'


Someone mentioned this on IRC the last week, it seems to be a Kid bug
in pull.py:

       current = self.current
       if current is None:
           current = []

so current can be a list and then they are trying to access:

      current.text

on a list.

Should be an easy fix I guess.


The reason we'd py:strip all those out tags is because of the ugly xmlns:py in 
the output.


That's the actual TextField template:

   template = """
   <input xmlns:py="http://purl.org/kid/ns#";
       type="text"
       name="${name}"
       class="${field_class}"
       id="${field_id}"
       value="${value}"
       py:attrs="attrs"
   />
   """

but as you can see xmlns:py is stripped from the final output:


from turbogears import widgets as w
text = w.TextField(name="name")
text.render()

'<INPUT ID="name" TYPE="text" CLASS="textfield" NAME="name">'

text.render(format="xhtml")

'<input id="name" type="text" class="textfield" name="name"></input>'

what's happening on your output?

Ciao
Michele


Well look at that, you're right.  I could have sworn that it was output
before.

Jason


--------------------------------------------------------------
David "Dwayne" Bernard            Freelance Developer
                                  mailto:[EMAIL PROTECTED]
      \|/                         http://dwayne.java-fan.com
--o0O @.@ O0o-------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to