Modify

Opened 9 years ago

Closed 9 years ago

#12693 closed defect (fixed)

AttributeError: 'str' object has no attribute 'realm'

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Component: TagsPlugin
Severity: normal Keywords:
Cc: Steffen Hoffmann Trac Release: 1.0

Description

Issue can be reproduced by navigating to /tags/bsd-license.

The logs have a lengthy error message:

2016-03-04 11:54:46,633 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/tags/bsd-license'">, referrer None
Traceback (most recent call last):
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/main.py", line 554, in _dispatch_request
    dispatcher.dispatch(req)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/main.py", line 267, in dispatch
    iterable=chrome.use_chunked_encoding)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/chrome.py", line 1114, in render_template
    encoding='utf-8')
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 183, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/output.py", line 339, in __call__
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/output.py", line 826, in __call__
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/output.py", line 670, in __call__
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/output.py", line 771, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/output.py", line 586, in __call__
    for ev in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/chrome.py", line 1320, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/chrome.py", line 1309, in _generate
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/filters/transform.py", line 686, in _unmark
    for mark, event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/filters/transform.py", line 1081, in __call__
    for mark, event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/filters/transform.py", line 117, in __iter__
    event = self.stream.next()
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/filters/transform.py", line 714, in __call__
    for mark, event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/filters/transform.py", line 682, in _mark
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 585, in _flatten
    stream = _apply_directives(data[1], data[0], ctxt, vars)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 262, in _apply_directives
    stream = directives[0](iter(stream), directives[1:], ctxt, **vars)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/filters/i18n.py", line 182, in __call__
    return _apply_directives(_generate(), directives, ctxt, vars)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 262, in _apply_directives
    stream = directives[0](iter(stream), directives[1:], ctxt, **vars)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/directives.py", line 638, in __call__
    matched = bool(_eval_expr(self.expr, ctxt, vars))
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/base.py", line 277, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/tractags/templates/tag_view.html", line 59, in <Expression u"tag_query and tag_page and tag_page.exists and                        'WIKI_VIEW' in perm('wiki', tag_page.resource)">
    <h1 py:when="tag_query and tag_page and tag_page.exists and
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/perm.py", line 562, in has_permission
    return self._has_permission(action, resource)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/perm.py", line 576, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/perm.py", line 468, in check_permission
    perm)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trachacks/web_ui.py", line 193, in check_permission
    resource.id and resource.id in self.help_pages and \
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/resource.py", line 121, in __eq__
    return self.realm == other.realm and \
AttributeError: 'str' object has no attribute 'realm'

The error page shows a shorter traceback, perhaps truncated:

File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/tractags/templates/tag_view.html", line 59, in <Expression u"tag_query and tag_page and tag_page.exists and                        'WIKI_VIEW' in perm('wiki', tag_page.resource)">
  <h1 py:when="tag_query and tag_page and tag_page.exists and
File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/perm.py", line 562, in has_permission
  return self._has_permission(action, resource)
File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/perm.py", line 576, in _has_permission
  check_permission(action, perm.username, resource, perm)
File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/perm.py", line 468, in check_permission
  perm)
File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trachacks/web_ui.py", line 193, in check_permission
  resource.id and resource.id in self.help_pages and \
File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/resource.py", line 121, in __eq__
  return self.realm == other.realm and \

Attachments (0)

Change History (2)

comment:2 Changed 9 years ago by Ryan J Ollos

In 15453:

0.9dev: Fix incorrect permission check

Refs #12693.

comment:3 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

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.