How to Reproduce
While doing a GET operation on /xmlrpc, Trac issued an internal error.
It seems to be related to the way descriptive texts are rendered (i.e. WikiFormatting). The full report suggested me that it is about rendering TracLinks pointing to missing (or non-existing) wiki pages.
User Agent was: Opera/9.63 (X11; Linux i686; U; en) Presto/2.1.1
| Trac | 0.11.1
|
| Python | 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
|
| setuptools | 0.6c8
|
| SQLite | 3.4.2
|
| pysqlite | 2.4.0
|
| Genshi | 0.5.1
|
| Pygments | 0.9
|
| RPC | 1.0.6
|
| jQuery: | 1.2.6
|
Python Traceback
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 423, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 197, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/tracrpc/web_ui.py", line 138, in process_request
'description' : wiki_to_oneliner(method.namespace_description, self.env),
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 1128, in wiki_to_oneliner
OneLinerFormatter(env, context).format(wikitext, out, shorten)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 954, in format
result = re.sub(self.wikiparser.rules, self.replace, result)
File "/usr/lib/python2.5/re.py", line 150, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 807, in replace
replacement = self.handle_match(fullmatch)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 800, in handle_match
return external_handler(self, match, fullmatch)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/api.py", line 277, in wikipagename_link
self.ignore_missing_pages)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/api.py", line 311, in _format_link
if 'WIKI_VIEW' in formatter.perm('wiki', pagename, version):
TypeError: 'NoneType' object is not callable
Full details
Most recent call last:
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py",
line 423, in
_dispatch_request
Code fragment:
try: if not env and env_error: raise HTTPInternalError(env_error) try: dispatcher = RequestDispatcher(env)
dispatcher.dispatch(req)
except RequestDone: pass resp = req._response or [] except HTTPException, e:
Local variables:
| Name | Value |
| after |
[u' except RequestDone:', u' pass', u' resp = ... |
| before |
[u' try:', u' if not env and env_error:', u' raise ... |
| dispatcher |
<trac.web.main.RequestDispatcher object at 0x8cad04c> |
| e |
TypeError("'NoneType' object is not callable",) |
| env |
<trac.env.Environment object at 0x8919fcc> |
| env_error |
None |
| exc_info |
(<type 'exceptions.TypeError'>, TypeError("'NoneType' object is not ... |
| filename |
'/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py' |
| frames |
[{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... |
| has_admin |
True |
| line |
u' dispatcher.dispatch(req)' |
| lineno |
422 |
| message |
u"TypeError: 'NoneType' object is not callable" |
| req |
<Request "GET u'/xmlrpc'"> |
| resp |
[] |
| tb |
<traceback object at 0x8c4dc34> |
| tb_hide |
None |
| traceback |
'Traceback (most recent call last):\n File ... |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py",
line 197, in
dispatch
Code fragment:
req.args.get('__FORM_TOKEN') != req.form_token: raise HTTPBadRequest('Missing or invalid form token. ' 'Do you have cookies enabled?') # Process the request and render the template
resp = chosen_handler.process_request(req)
if resp: if len(resp) == 2: # Clearsilver chrome.populate_hdf(req) template, content_type = \ self._post_process_request(req, *resp)
Local variables:
| Name | Value |
| chosen_handler |
<tracrpc.web_ui.XMLRPCWeb object at 0x8cad74c> |
| chrome |
<trac.web.chrome.Chrome object at 0x8cad4cc> |
| err |
(<type 'exceptions.TypeError'>, TypeError("'NoneType' object is not ... |
| handler |
<tracrpc.web_ui.XMLRPCWeb object at 0x8cad74c> |
| req |
<Request "GET u'/xmlrpc'"> |
| self |
<trac.web.main.RequestDispatcher object at 0x8cad04c> |
-
File "build/bdist.linux-i686/egg/tracrpc/web_ui.py",
line 138, in
Local variables:
| Name | Value |
| content_type |
'text/html' |
| method |
<tracrpc.api.Method object at 0x8be22cc> |
| namespace |
'source' |
| namespaces |
{'wiki': {'namespace': 'wiki', 'description': <Markup u'Superset of ... |
| req |
<Request "GET u'/xmlrpc'"> |
| self |
<tracrpc.web_ui.XMLRPCWeb object at 0x8cad74c> |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py",
line 1128, in
wiki_to_oneliner
Code fragment:
if not wikitext: return Markup() abs_ref, href = (req or env).abs_href, (req or env).href context = Context.from_request(req, absurls=absurls) out = StringIO()
OneLinerFormatter(env, context).format(wikitext, out, shorten)
return Markup(out.getvalue()) def wiki_to_outline(wikitext, env, db=None, absurls=False, max_depth=None, min_depth=None): if not wikitext:
Local variables:
| Name | Value |
| abs_ref |
<trac.web.href.Href object at 0x86af28c> |
| absurls |
False |
| context |
<Context > |
| db |
None |
| env |
<trac.env.Environment object at 0x8919fcc> |
| href |
<trac.web.href.Href object at 0x8b1592c> |
| out |
<StringIO.StringIO instance at 0x8b955ac> |
| req |
None |
| shorten |
False |
| wikitext |
"An interface to Trac's Repository and RepositoryManager.\n " |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py",
line 954, in
format
Code fragment:
result = buf.getvalue()[:-len(os.linesep)] if shorten: result = shorten_line(result)
result = re.sub(self.wikiparser.rules, self.replace, result)
result = result.replace('[...]', u'[\u2026]') if result.endswith('...'): result = result[:-3] + u'\u2026' # Close all open 'one line'-tags
Local variables:
| Name | Value |
| buf |
<StringIO.StringIO instance at 0x8b0ae8c> |
| in_code_block |
0 |
| line |
"An interface to Trac's Repository and RepositoryManager." |
| out |
<StringIO.StringIO instance at 0x8b955ac> |
| processor |
None |
| result |
"An interface to Trac's Repository and RepositoryManager." |
| self |
<trac.wiki.formatter.OneLinerFormatter object at 0x8c38e6c> |
| shorten |
False |
| text |
"An interface to Trac's Repository and RepositoryManager.\n " |
-
File "/usr/lib/python2.5/re.py",
line 150, in
sub
Code fragment:
"""Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a callable, it's passed the match object and must return a replacement string to be used."""
return _compile(pattern, 0).sub(repl, string, count)
def subn(pattern, repl, string, count=0): """Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source
Local variables:
| Name | Value |
| count |
0 |
| pattern |
<_sre.SRE_Pattern object at 0x8b48338> |
| repl |
<bound method OneLinerFormatter.replace of ... |
| string |
"An interface to Trac's Repository and RepositoryManager." |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py",
line 807, in
replace
Code fragment:
internal_handler = getattr(self, '_%s_formatter' % itype) return internal_handler(match, fullmatch) def replace(self, fullmatch): """Replace one match with its corresponding expansion"""
replacement = self.handle_match(fullmatch)
if replacement: return _markup_to_unicode(replacement) def reset(self, source, out=None): self.source = source
Local variables:
| Name | Value |
| fullmatch |
<_sre.SRE_Match object at 0x8c1b868> |
| self |
<trac.wiki.formatter.OneLinerFormatter object at 0x8c38e6c> |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py",
line 800, in
handle_match
Code fragment:
# Check for preceding escape character '!' if match[0] == '!': return escape(match[1:]) if itype in self.wikiparser.external_handlers: external_handler = self.wikiparser.external_handlers[itype]
return external_handler(self, match, fullmatch)
else: internal_handler = getattr(self, '_%s_formatter' % itype) return internal_handler(match, fullmatch) def replace(self, fullmatch):
Local variables:
| Name | Value |
| external_handler |
<function wikipagename_link at 0x8924bc4> |
| fullmatch |
<_sre.SRE_Match object at 0x8c1b868> |
| itype |
'i0' |
| match |
'RepositoryManager' |
| self |
<trac.wiki.formatter.OneLinerFormatter object at 0x8c38e6c> |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/api.py",
line 277, in
wikipagename_link
Code fragment:
def wikipagename_link(formatter, match, fullmatch): if not _check_unicode_camelcase(match): return match return self._format_link(formatter, 'wiki', match, self.format_page_name(match),
self.ignore_missing_pages)
yield (r"!?(?<!/)\b" + # start at a word boundary but not after '/' wiki_page_name, wikipagename_link) # [WikiPageNames with label]
Local variables:
| Name | Value |
| formatter |
<trac.wiki.formatter.OneLinerFormatter object at 0x8c38e6c> |
| fullmatch |
<_sre.SRE_Match object at 0x8c1b868> |
| match |
'RepositoryManager' |
| self |
<trac.wiki.api.WikiSystem object at 0x8cad28c> |
-
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/api.py",
line 311, in
_format_link
Code fragment:
if '@' in pagename: pagename, version = pagename.split('@', 1) if version and query: query = '&' + query[1:] pagename = pagename.rstrip('/')
if 'WIKI_VIEW' in formatter.perm('wiki', pagename, version):
href = formatter.href.wiki(pagename, version=version) + query \ + fragment if self.has_page(pagename): return tag.a(label, href=href, class_='wiki') else:
Local variables:
| Name | Value |
| formatter |
<trac.wiki.formatter.OneLinerFormatter object at 0x8c38e6c> |
| fragment |
'' |
| ignore_missing |
False |
| label |
'RepositoryManager' |
| ns |
'wiki' |
| pagename |
'RepositoryManager' |
| query |
'' |
| self |
<trac.wiki.api.WikiSystem object at 0x8cad28c> |
| version |
None |
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 423, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 197, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/tracrpc/web_ui.py", line 138, in process_requestFile "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 1128, in wiki_to_oneliner
OneLinerFormatter(env, context).format(wikitext, out, shorten)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 954, in format
result = re.sub(self.wikiparser.rules, self.replace, result)
File "/usr/lib/python2.5/re.py", line 150, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 807, in replace
replacement = self.handle_match(fullmatch)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/formatter.py", line 800, in handle_match
return external_handler(self, match, fullmatch)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/api.py", line 277, in wikipagename_link
self.ignore_missing_pages)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/api.py", line 311, in _format_link
if 'WIKI_VIEW' in formatter.perm('wiki', pagename, version):