Modify

Opened 12 years ago

Closed 8 years ago

#10620 closed defect (fixed)

UndefinedError: "data" not defined when navigating to the Announcements preference panel

Reported by: Ryan J Ollos Owned by:
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords: UndefinedError
Cc: Trac Release: 0.11

Description

07:07:32 PM Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/home/user/Workspace/th9110/trac-trunk/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/user/Workspace/th9110/trac-trunk/trac/web/main.py", line 233, in dispatch
    content_type)
  File "/home/user/Workspace/th9110/trac-trunk/trac/web/chrome.py", line 1008, in render_template
    encoding='utf-8')
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 183, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/output.py", line 339, in __call__
    for kind, data, pos in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/output.py", line 826, in __call__
    for kind, data, pos in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/output.py", line 670, in __call__
    for kind, data, pos in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/output.py", line 771, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/output.py", line 586, in __call__
    for ev in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/home/user/Workspace/th9110/trac-trunk/trac/web/chrome.py", line 1145, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/home/user/Workspace/th9110/trac-trunk/trac/web/chrome.py", line 1134, in _generate
    for kind, data, pos in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/markup.py", line 362, in _match
    content = list(content)
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 555, in _flatten
    for event in self._flatten(value, ctxt, **vars)
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 565, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/base.py", line 277, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/home/user/Workspace/trac-hacks/announcerplugin/trunk/announcer/templates/prefs_announcer_watch_users.html", line 10, in <Expression u'data.announcer_watch_users'>
    <input type="text" id="announcer_watch_users" name="announcer_watch_users"
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/eval.py", line 316, in lookup_attr
    val = getattr(obj, key)
  File "/home/user/Workspace/th9110/genshi-0.6.0/genshi/template/eval.py", line 277, in _die
    raise UndefinedError(self._name, self._owner)
UndefinedError: "data" not defined

Attachments (0)

Change History (6)

comment:1 Changed 12 years ago by Ryan J Ollos

The fix appears to be:

  • announcerplugin/trunk/announcer/templates/prefs_announcer_watch_users.html

     
    88     a wiki page or ticket.  <br />
    99     <label for="announcer_watch_users">Watch Users:
    1010     <input type="text" id="announcer_watch_users" name="announcer_watch_users"
    11        value="${data.announcer_watch_users}"/></label>
     11       value="${announcer_watch_users}"/></label>
    1212</span>

comment:2 Changed 12 years ago by Ryan J Ollos

I'd suggest that as part of this ticket we wire up the infrastructure for functional tests, and add a functional test to cover this issue. This is at the front of my mind due to recent work on t:#10281. If you agree, you can count on me to provide a patch that adds functional tests in the coming days.

comment:3 Changed 12 years ago by Steffen Hoffmann

Keywords: UndefinedError added

Oops …, I did a simplification to the call of this template, but forgot about references in the template itself, and even worse, I didn't test this templates usage before commit. So sure, if you can work-out the intro for functional tests for announcer, this would be great. I'll just go and fix this issue right-away.

comment:4 Changed 12 years ago by Steffen Hoffmann

(In [12356]) TracAnnouncer: Adapt the template to data dict change in [12338], refs #10620.

Obviously I failed to track all my changes in that changeset, and especially the move-and-modernize approach has fired back here - sorry, and thanks to Ryan J Ollos for spotting this as well as the right place for the fix.

I took the chance to improve template format like I'd do for others later on. That's bound to break msgid's for translation, but I'll need to do a message extraction for other recent i18n-relevant changes anyway.

comment:5 Changed 8 years ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:6 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.