Edgewall Software

Opened 17 years ago

Closed 17 years ago

#87 closed defect (worksforme)

Strange behaviour of ET under TG

Reported by: Graham Higgins Owned by: cmlenz
Priority: major Milestone:
Component: General Version: devel
Keywords: Cc: needinfo

Description (last modified by mgood)

Seeing strange behaviour with ET under TurboGears trunk (2216):

Here's the traceback:

  File "/www/lib/tg/turbogears/turbogears/util.py", line 166, in adapt_call
    return func(*args, **kw)
  File "/www/lib/tg/thirdparty/genshi/genshi/template/plugin.py", line 91, in render
    return self.transform(info, template).render(**kwargs)
  File "/www/lib/tg/thirdparty/genshi/genshi/core.py", line 147, in render
    output = u''.join(list(generator))
  File "/www/lib/tg/thirdparty/genshi/genshi/output.py", line 203, in __call__
    for kind, data, pos in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/output.py", line 489, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/www/lib/tg/thirdparty/genshi/genshi/output.py", line 439, in __call__
    for kind, data, pos in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/core.py", line 208, in _ensure
    for event in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/template/markup.py", line 197, in _include
    for event in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/template/markup.py", line 283, in _match
    match_templates[:idx] +
  File "/www/lib/tg/thirdparty/genshi/genshi/template/markup.py", line 267, in _match
    content = list(self._include(content, ctxt))
  File "/www/lib/tg/thirdparty/genshi/genshi/template/markup.py", line 197, in _include
    for event in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/template/markup.py", line 242, in _match
    for event in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/template/markup.py", line 231, in _strip
    event = stream.next()
  File "/www/lib/tg/thirdparty/genshi/genshi/template/core.py", line 331, in _eval
    for event in substream:
  File "/www/lib/tg/thirdparty/genshi/genshi/template/core.py", line 297, in _eval
    for kind, data, pos in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/template/core.py", line 341, in _flatten
    for event in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/core.py", line 208, in _ensure
    for event in stream:
  File "/www/lib/tg/thirdparty/genshi/genshi/input.py", line 32, in ET
    tag_name = QName(element.tag.lstrip('{'))
AttributeError: 'Stream' object has no attribute 'tag'

This has been around for a while. I assume it's peculiar to my setup otherwise someone else would have reported it. I have a workaround which is to switch the ET for XML:

<head profile="http://www.w3.org/2003/g/data-view"  py:match="head" py:attrs="select('@*')">
    <title py:replace="''">Your title goes here</title>
    <link py:for="js in tg_js_head" py:replace="XML(js.display())" />
    <link py:for="css in tg_css" py:replace="ET(css.display())" />
    <meta py:replace="select('*')" />
</head>

The problem doesn't seem to be related to the profile attribute in that it persists even when the profile attribute-value pair is removed.

Attachments (4)

sitetemplate.html (959 bytes) - added by Graham Higgins 17 years ago.
sitetemplate.html
master.html (1.1 KB) - added by Graham Higgins 17 years ago.
master.html
macros.html (4.9 KB) - added by Graham Higgins 17 years ago.
macros.html
navarea.html (1.6 KB) - added by navarea.html 17 years ago.
Ancillary inclusion

Download all attachments as: .zip

Change History (10)

Changed 17 years ago by Graham Higgins

sitetemplate.html

Changed 17 years ago by Graham Higgins

master.html

Changed 17 years ago by Graham Higgins

macros.html

Changed 17 years ago by navarea.html

Ancillary inclusion

comment:1 Changed 17 years ago by anonymous

  • Version changed from 0.3.5 to devel

comment:2 Changed 17 years ago by anonymous

I tried switching to 0.3.6 but got this apparently related error:

body = page_handler(*virtual_path, self.params)

File "<string>", line 3, in index File "/www/lib/tg/turbogears/turbogears/controllers.py", line 284, in expose

output = database.run_with_transaction(

File "<string>", line 5, in run_with_transaction File "/www/lib/tg/turbogears/turbogears/database.py", line 293, in sa_rwt

retval = dispatch_exception(e,args,kw)

File "/www/lib/tg/turbogears/turbogears/database.py", line 282, in sa_rwt

retval = func(*args, kw)

File "<string>", line 5, in _expose File "/www/lib/tg/turbogears/turbogears/controllers.py", line 301, in <lambda>

mapping, fragment, args, kw)))

File "/www/lib/tg/turbogears/turbogears/controllers.py", line 341, in _execute_func

return _process_output(output, template, format, content_type, mapping, fragment)

File "/www/lib/tg/turbogears/turbogears/controllers.py", line 81, in _process_output

mapping=mapping, content_type=content_type,fragment=fragment)

File "/www/lib/tg/turbogears/turbogears/view/base.py", line 125, in render

return adapt_call(engine.render, dict(info=info, format=format, fragment=fragment, template=template, mapping=mapping))

File "/www/lib/tg/turbogears/turbogears/util.py", line 166, in adapt_call

return func(*args, kw)

File "build/bdist.linux-i686/egg/genshi/plugin.py", line 78, in render File "build/bdist.linux-i686/egg/genshi/core.py", line 141, in render File "build/bdist.linux-i686/egg/genshi/output.py", line 203, in call File "build/bdist.linux-i686/egg/genshi/output.py", line 491, in call File "build/bdist.linux-i686/egg/genshi/output.py", line 439, in call File "build/bdist.linux-i686/egg/genshi/core.py", line 202, in _ensure File "build/bdist.linux-i686/egg/genshi/filters.py", line 147, in call File "build/bdist.linux-i686/egg/genshi/template.py", line 1166, in _match File "build/bdist.linux-i686/egg/genshi/template.py", line 1149, in _match File "build/bdist.linux-i686/egg/genshi/filters.py", line 147, in call File "build/bdist.linux-i686/egg/genshi/template.py", line 1123, in _match File "build/bdist.linux-i686/egg/genshi/template.py", line 1112, in _strip File "build/bdist.linux-i686/egg/genshi/template.py", line 946, in _eval File "build/bdist.linux-i686/egg/genshi/template.py", line 902, in _eval File "build/bdist.linux-i686/egg/genshi/template.py", line 954, in _flatten File "build/bdist.linux-i686/egg/genshi/core.py", line 202, in _ensure File "build/bdist.linux-i686/egg/genshi/plugin.py", line 29, in ET

AttributeError?: 'Stream' object has no attribute 'tag'

Same workaround fixes the problem.

comment:3 Changed 17 years ago by Graham Higgins

Last piece of info:

Genshi settings in TG's project/config/app.cfg are:

genshi.outputformat = "xml"

genshi.assume_encoding="utf-8"

genshi.encoding="utf-8"

comment:4 Changed 17 years ago by mgood

  • Cc needinfo added
  • Description modified (diff)

What happens if you just use js.display() and css.display() without using the ET() method? It sounds like you're passing a Genshi Stream object to the ET method instead of an ElementTree element. If that's the case then you don't need to wrap it with either the XML or ET calls.

comment:5 Changed 17 years ago by cmlenz

  • Milestone 0.4 deleted

comment:6 Changed 17 years ago by cmlenz

  • Resolution set to worksforme
  • Status changed from new to closed

Closing due to lack of information, which would be required to find out whether the problem is in Genshi.

Note: See TracTickets for help on using tickets.