Modify

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#12762 closed defect (fixed)

UndefinedError: "format_to_oneliner" not defined

Reported by: ntmlod Owned by: Ryan J Ollos
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I get this internal error with the last revision of 1.0 branch when I click on the link to the main page in order to view the forum list.

Here is the extract of the log:

File "/var/www/.python-eggs/TracDiscussion-0.10dev-py2.7.egg-tmp/tracdiscussion/templates/forum-list.html", line 24, in <Expression u'format_to_oneliner(discussion.env, context, group.name)'>
  <div class="name">${format_to_oneliner(discussion.env, context, group.name)}</div>

Attachments (0)

Change History (8)

comment:1 Changed 9 years ago by ntmlod

I found a way to fix it by renaming format_to_oneliner by format_to_oneliner_no_links in the file ./tracdiscussion/templates/forum-list.html. Not sure at all it is a clever solution.

By the way, the rendering issue #12740 is still here with 1.0 branch.

comment:2 Changed 9 years ago by Ryan J Ollos

Could you post the full traceback?

comment:3 Changed 9 years ago by ntmlod

Here you are:

  File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib/python2.7/site-packages/trac/web/chrome.py", line 1152, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib/python2.7/site-packages/trac/web/chrome.py", line 1141, in _generate
    for kind, data, pos in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/filters/transform.py", line 686, in _unmark
    for mark, event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/filters/transform.py", line 1145, in __call__
    for mark, event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/filters/transform.py", line 714, in __call__
    for mark, event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/filters/transform.py", line 682, in _mark
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 362, in _match
    content = list(content)
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/usr/lib64/python2.7/site-packages/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 565, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/usr/lib64/python2.7/site-packages/genshi/template/base.py", line 277, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/usr/lib64/python2.7/site-packages/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/var/www/.python-eggs/TracDiscussion-0.10dev-py2.7.egg-tmp/tracdiscussion/templates/forum-list.html", line 24, in <Expression u'format_to_oneliner(discussion.env, context, group.name)'>
    <div class="name">${format_to_oneliner(discussion.env, context, group.name)}</div>
  File "/usr/lib64/python2.7/site-packages/genshi/template/eval.py", line 277, in _die
    raise UndefinedError(self._name, self._owner)
UndefinedError: "format_to_oneliner" not defined

comment:4 Changed 8 years ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Status: newaccepted

comment:5 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 15547:

0.10dev: Implement another change that was overlooked in [14884]

Refs #10593.
Fixes #12762.

comment:6 Changed 8 years ago by ntmlod

Well, it seems your fix generates another issue on the topic list view: UndefinedError: "dcontext" not defined

Here is the traceback

File "/var/www/.python-eggs/TracDiscussion-0.10dev-py2.7.egg-tmp/tracdiscussion/templates/topic-list-compact.html", line 32, in <Expression u"discussion.format_to_oneliner_no_links(dcontext, topic.subject) or '\xa0'">
  <strong>${discussion.format_to_oneliner_no_links(dcontext, topic.subject) or '&nbsp;'}</strong>
File "build/bdist.linux-x86_64/egg/tracdiscussion/util.py", line 29, in format_to_oneliner_no_links
  stream = HTML(format_to_oneliner(env, context, to_unicode(content)))
File "/usr/lib/python2.7/site-packages/trac/wiki/formatter.py", line 1552, in format_to_oneliner
  shorten = context.get_hint('shorten_lines', False)

Should I create another ticket for this ?

comment:7 Changed 8 years ago by ntmlod

Probably not, this bug is a typo inserted in the last commit in topic-list-compact.html and unfortunately or not I precisely used the offending view.

comment:8 Changed 8 years ago by Ryan J Ollos

In 15549:

0.10dev: Fix typo in [15548]

Refs #11706, #12762.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.