Edgewall Software

Opened 18 years ago

Last modified 18 years ago

#3922 closed defect

NameError: Variable "attachment" is not defined — at Version 3

Reported by: malawar Owned by: Christian Boos
Priority: high Milestone: 0.11
Component: general Version: devel
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Trying to delete a file attached to WikiStart, using the latest builds from svn for Trac and Genshi. < and > replaced with ( and )

How to Reproduce

While doing a GET operation on /attachment/wiki/WikiStart/Some Attached Document With Spaces.doc, Trac issued an internal error.

System Information

Python 2.4.4c0 (#1, Jul 30 2006, 15:39:57)
[GCC 4.1.2 20060715 (prerelease) (Debian 4.1.1-9)]
Subversion 1.3.2
SQLite 3.3.7
pysqlite 2.3.2

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 366, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch
    content_type, data)
  File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 469, in render_response
    return stream.render(method, doctype=doctype)
  File "/usr/lib/python2.4/site-packages/genshi/core.py", line 146, in render
    output = u''.join(list(generator))
  File "/usr/lib/python2.4/site-packages/genshi/output.py", line 200, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/genshi/output.py", line 488, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/usr/lib/python2.4/site-packages/genshi/output.py", line 436, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/genshi/core.py", line 207, in _ensure
    for event in stream:
  File "/usr/lib/python2.4/site-packages/genshi/filters.py", line 313, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/genshi/template.py", line 1128, in _match
    content = list(content)
  File "/usr/lib/python2.4/site-packages/genshi/filters.py", line 313, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/genshi/template.py", line 1103, in _match
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/genshi/template.py", line 1092, in _strip
    kind, data, pos = stream.next()
  File "/usr/lib/python2.4/site-packages/genshi/template.py", line 912, in _eval
    result = data.evaluate(ctxt)
  File "/usr/lib/python2.4/site-packages/genshi/eval.py", line 95, in evaluate
    {'data': data})
  File "/usr/share/trac/templates/attachment.html", line 55, in (Expression u"attachment.filename")
    (h1)(a href="$parent.href")$parent.name(/a): $attachment.filename(/h1)
  File "/usr/lib/python2.4/site-packages/genshi/eval.py", line 199, in _lookup_attr
    obj.throw()
  File "/usr/lib/python2.4/site-packages/genshi/eval.py", line 152, in throw
    raise NameError('Variable "%s" is not defined' % self.name)
NameError: Variable "attachment" is not defined

Change History (3)

comment:1 by malawar@…, 18 years ago

Priority: normalhigh
Severity: normalmajor

raised priority and severity on the ticket.

comment:2 by Christian Boos, 18 years ago

Yay! Our first automated report :)

Ain't that nice :)

comment:3 by Christian Boos, 18 years ago

Description: modified (diff)
Milestone: 0.11
Owner: changed from Jonas Borgström to Christian Boos

(in automated reports, the Python version info is sometimes output in multiple lines (on Unix), so we should either remove the newlines in the second column of System Information [3897] or respect the newline by introducing a [[br]] [3898])

Concerning < and > replaced with ( and ) , does that mean that the "<" and ">" in the traceback don't get escaped? I'll check.

Now, back to the topic: I couldn't reproduce the problem… attachments (even with spaces in the file name) seem to work fine for me (attaching, previewing, getting them in plaintext, etc.), can you describe more precisely what operations you were doing?

Note: See TracTickets for help on using tickets.