Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#4420 closed defect (fixed)

TypeError when diffing wiki page

Reported by: Manuzhai <manuzhai@…> Owned by: Christian Boos
Priority: high Milestone: 0.11
Component: wiki system Version: devel
Severity: normal Keywords:
Cc: mankoff@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I'm getting this traceback when trying to view a wiki page diff:

#   File "/home/manuzhai/src/trac/trac/web/main.py", line 395, in  dispatch_request
Code fragment:

 389. req = Request(environ, start_response)
 390. try:
 391. try:
 392. try:
 393. dispatcher = RequestDispatcher(env)
 394. dispatcher.dispatch(req)
 395. except RequestDone:
 396. pass
 397. return req._response or []
 398. finally:
 399. if not run_once:

Local variables:
Name	Value
after 	[' except RequestDone:', ' pass', ' ...
before 	[' req = Request(environ, start_response)', ' try:', ' try:', ...
dispatcher 	<trac.web.main.RequestDispatcher object at 0xb676762c>
e 	<exceptions.TypeError instance at 0xb679878c>
egg_cache 	'/tmp/eggs'
env 	<trac.env.Environment object at 0xb6acbe2c>
env_name 	'nts'
env_parent_dir 	'/var/trac'
env_path 	'/var/trac/nts'
env_paths 	None
environ 	{'AUTH_TYPE': 'Basic', 'HTTP_AUTHORIZATION': 'Basic ...
exc_info 	(<class exceptions.TypeError at 0xb6f3e2fc>, <exceptions.TypeError ...
filename 	'/home/manuzhai/src/trac/trac/web/main.py'
frames 	[{'function': 'dispatch_request', 'lines_before': [' req = ...
line 	' dispatcher.dispatch(req)'
lineno 	394
message 	u'TypeError: function takes exactly 3 arguments (0 given)'
options 	{'TracEnvParentDir': '/var/trac', 'TracUriRoot': '/'}
path_info 	['wiki', 'WikiStart']
req 	<Request "GET /wiki/WikiStart">
request_uri 	'/nts/wiki/WikiStart'
root_uri 	''
run_once 	False
start_response 	<bound method ModPythonGateway._start_response of ...
tb 	<traceback object at 0xb56f8d4c>
traceback 	'Traceback (most recent call last):\n File ...
# File "/home/manuzhai/src/trac/trac/web/main.py", line 227, in dispatch
Code fragment:

 221. req.display(template, content_type or 'text/html')
 222. else: # Genshi
 223. # FIXME: postprocess API need to be adapted...
 224. template, data, content_type = resp
 225. output = chrome.render_template(req, template, data,
 226. content_type)
 227. # Give the session a chance to persist changes
 228. if req.session:
 229. req.session.save()
 230. req.send(output, content_type or 'text/html')
 231. else:

Local variables:
Name	Value
chosen_handler 	<trac.wiki.web_ui.WikiModule object at 0xb6767eac>
chrome 	<trac.web.chrome.Chrome object at 0xb6b2682c>
content_type 	None
data 	{'longcol': 'Version', 'new_version': 17, 'title': u'WikiStart (diff)', ...
err 	(<class exceptions.TypeError at 0xb6f3e2fc>, <exceptions.TypeError ...
handler 	<trac.wiki.web_ui.WikiModule object at 0xb6767eac>
req 	<Request "GET /wiki/WikiStart">
resp 	('wiki_diff.html', {'longcol': 'Version', 'new_version': 17, 'title': ...
self 	<trac.web.main.RequestDispatcher object at 0xb676762c>
template 	'wiki_diff.html'
# File "/home/manuzhai/src/trac/trac/web/chrome.py", line 543, in render_template
Code fragment:

 537. data.setdefault('chrome', {}).update({
 538. 'late_links': req.chrome['links'],
 539. 'late_scripts': req.chrome['scripts'],
 540. })
 541.  
 542. return stream.render(method, doctype=doctype)
 543.  
 544. # Template filters
 545.  
 546. def _add_form_token(self, token):
 547. elem = tag.div(

Local variables:
Name	Value
content_type 	'text/html'
data 	{'all': <function all at 0xb6d7d79c>, 'pprint': <function pformat at ...
doctype 	('html', '-//W3C//DTD XHTML 1.0 Strict//EN', ...
filename 	'wiki_diff.html'
fragment 	False
method 	'xhtml'
req 	<Request "GET /wiki/WikiStart">
self 	<trac.web.chrome.Chrome object at 0xb6b2682c>
stream 	<genshi.core.Stream object at 0xb677fcbc>
template 	<MarkupTemplate "wiki_diff.html">
# File "build/bdist.linux-i686/egg/genshi/core.py", line 141, in render
Local variables:
Name	Value
encoding 	'utf-8'
generator 	<generator object at 0xb679882c>
kwargs 	{'doctype': ('html', '-//W3C//DTD XHTML 1.0 Strict//EN', ...
method 	'xhtml'
self 	<genshi.core.Stream object at 0xb677fcbc>
# File "build/bdist.linux-i686/egg/genshi/output.py", line 203, in __call__
Local variables:
Name	Value
attr 	u'content'
attrib 	[(u'name', u'ROBOTS'), (u'content', u'NOINDEX, NOFOLLOW')]
attrname 	u'content'
boolean_attrs 	frozenset(['compact', 'defer', 'checked', 'nohref', 'selected', 'ismap', ...
buf 	['<', u'meta', ' ', u'name', '="', <Markup "ROBOTS">, '"', ' ', ...
data 	u'{http://www.w3.org/1999/xhtml}head'
empty_elems 	frozenset(['img', 'area', 'basefont', 'frame', 'isindex', 'meta', 'param', ...
filter_ 	<genshi.output.WhitespaceFilter object at 0xb679884c>
have_doctype 	True
in_cdata 	False
kind 	'END'
name 	'html'
namespace 	<Namespace "http://www.w3.org/1999/xhtml">
ns_attrib 	[]
ns_mapping 	{u'http://www.w3.org/1999/xhtml': '', ...
pos 	(u'layout.html', 26, 2)
prefix 	''
pubid 	'-//W3C//DTD XHTML 1.0 Strict//EN'
self 	<genshi.output.XHTMLSerializer object at 0xb679876c>
stream 	<generator object at 0xb6798a4c>
sysid 	'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
tag 	u'{http://www.w3.org/1999/xhtml}head'
tagname 	u'head'
tagns 	u'http://www.w3.org/1999/xhtml'
uri 	u'http://www.w3.org/1999/xhtml'
value 	u'NOINDEX, NOFOLLOW'
# File "build/bdist.linux-i686/egg/genshi/output.py", line 491, in __call__
Local variables:
Name	Value
attrs 	[]
collapse_lines 	<built-in method sub of _sre.SRE_Pattern object at 0xb6d89e00>
ctxt 	None
data 	u'\n\n '
escape_cdata 	False
kind 	'TEXT'
mjoin 	<bound method Markup.join of <Markup "">>
noescape 	False
noescape_elems 	frozenset([])
pop_text 	<built-in method pop of list object at 0xb6782bcc>
pos 	('wiki_diff.html', 13, -1)
preserve 	0
preserve_elems 	frozenset([u'pre', u'{http://www.w3.org/1999/xhtml}textarea', u'textarea', ...
push_text 	<built-in method append of list object at 0xb6782bcc>
self 	<genshi.output.WhitespaceFilter object at 0xb679884c>
space 	u'{http://www.w3.org/XML/1998/namespace}space'
stream 	<generator object at 0xb679892c>
tag 	u'{http://www.w3.org/1999/xhtml}title'
text 	u'\n '
textbuf 	[u'\n\n ']
trim_trailing_space 	<built-in method sub of _sre.SRE_Pattern object at 0xb6ca61d0>
# File "build/bdist.linux-i686/egg/genshi/output.py", line 439, in __call__
Local variables:
Name	Value
data 	u'\n\n '
kind 	'TEXT'
pos 	('wiki_diff.html', 13, -1)
prev 	('TEXT', u'\n\n ', ('wiki_diff.html', 13, -1))
self 	<genshi.output.EmptyTagFilter object at 0xb67988ec>
stream 	<itertools.chain object at 0xb67988cc>
# File "build/bdist.linux-i686/egg/genshi/core.py", line 202, in _ensure
Local variables:
Name	Value
event 	('TEXT', u'\n\n ', ('wiki_diff.html', 13, -1))
stream 	<genshi.core.Stream object at 0xb677fcbc>
# File "build/bdist.linux-i686/egg/genshi/core.py", line 202, in _ensure
Local variables:
Name	Value
event 	('TEXT', u'\n\n ', ('wiki_diff.html', 13, -1))
stream 	<generator object at 0xb679894c>
# File "/home/manuzhai/src/trac/trac/web/chrome.py", line 563, in _strip_accesskeys
Code fragment:

 557. else:
 558. yield kind, data, pos
 559. return _generate
 560.  
 561. def _strip_accesskeys(self, stream, ctxt=None):
 562. for kind, data, pos in stream:
 563. if kind is START and 'accesskey' in data[1]:
 564. data = data[0], Attrs([(k,v) for k,v in data[1]
 565. if k != 'accesskey'])
 566. yield kind, data, pos

Local variables:
Name	Value
ctxt 	None
data 	u'\n\n '
kind 	'TEXT'
pos 	('wiki_diff.html', 13, -1)
self 	<trac.web.chrome.Chrome object at 0xb6b2682c>
stream 	<genshi.core.Stream object at 0xb677fcd4>
# File "build/bdist.linux-i686/egg/genshi/core.py", line 202, in _ensure
Local variables:
Name	Value
event 	('TEXT', u'\n\n ', ('wiki_diff.html', 13, -1))
stream 	<generator object at 0xb67987ac>
# File "/home/manuzhai/src/trac/trac/web/chrome.py", line 552, in _generate
Code fragment:

 546. def _add_form_token(self, token):
 547. elem = tag.div(
 548. tag.input(type='hidden', name='__FORM_TOKEN', value=token)
 549. )
 550. def _generate(stream, ctxt=None):
 551. for kind, data, pos in stream:
 552. if kind is START and data[0].localname == 'form' \
 553. and data[1].get('method', '').lower() == 'post':
 554. yield kind, data, pos
 555. for event in elem.generate():
 556. yield event

Local variables:
Name	Value
ctxt 	None
data 	u'\n\n '
elem 	<Element "div">
kind 	'TEXT'
pos 	('wiki_diff.html', 13, -1)
stream 	<genshi.core.Stream object at 0xb677fc44>
# File "build/bdist.linux-i686/egg/genshi/filters.py", line 147, in __call__
Local variables:
Name	Value
TemplateError 	<class genshi.template.TemplateError at 0xb6c22d7c>
TemplateNotFound 	<class genshi.template.TemplateNotFound at 0xb6c4bd1c>
attrib 	[(u'href', u'macros.html')]
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	u'\n\n '
event 	('END_NS', '', (u'macros.html', 214, 0))
fallback_stream 	None
in_fallback 	False
include_href 	None
kind 	'TEXT'
namespace 	<Namespace "http://www.w3.org/2001/XInclude">
ns_prefixes 	[u'xi']
pos 	('wiki_diff.html', 13, -1)
self 	<genshi.filters.IncludeFilter object at 0xb676c78c>
stream 	<generator object at 0xb67936cc>
tag 	u'{http://www.w3.org/2001/XInclude}include'
template 	<MarkupTemplate "macros.html">
# File "build/bdist.linux-i686/egg/genshi/template.py", line 1149, in _match
Local variables:
Name	Value
_strip 	<function _strip at 0xb6774ed4>
content 	<generator object at 0xb5712d4c>
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	(u'{http://www.w3.org/1999/xhtml}body', [])
directives 	[]
event 	('END', u'{http://www.w3.org/1999/xhtml}head', (u'layout.html', 26, 2))
filter_ 	<genshi.filters.IncludeFilter object at 0xb676c78c>
idx 	1
kind 	'START'
match_templates 	[(<function _test at 0xb677648c>, <Path "child::head">, [('START', ...
mt 	(<function _test at 0xb677641c>, <Path "child::body">, [('START', ...
namespaces 	{'': u'http://www.w3.org/1999/xhtml', u'py': ...
path 	<Path "child::body">
pos 	('wiki_diff.html', 15, 2)
select 	<function select at 0xb6774e9c>
self 	<MarkupTemplate "wiki_diff.html">
stream 	<generator object at 0xb679372c>
tail 	[('END', u'{http://www.w3.org/1999/xhtml}head', ('wiki_diff.html', 13, ...
template 	[('START', (u'{http://www.w3.org/1999/xhtml}body', []), (u'layout.html', ...
test 	<function _test at 0xb677641c>
# File "build/bdist.linux-i686/egg/genshi/filters.py", line 147, in __call__
Local variables:
Name	Value
TemplateError 	<class genshi.template.TemplateError at 0xb6c22d7c>
TemplateNotFound 	<class genshi.template.TemplateNotFound at 0xb6c4bd1c>
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	u'\n '
fallback_stream 	None
in_fallback 	False
include_href 	None
kind 	'TEXT'
namespace 	<Namespace "http://www.w3.org/2001/XInclude">
ns_prefixes 	[]
pos 	('wiki_diff.html', 42, -1)
self 	<genshi.filters.IncludeFilter object at 0xb676c78c>
stream 	<itertools.chain object at 0xb67984ec>
# File "build/bdist.linux-i686/egg/genshi/template.py", line 1123, in _match
Local variables:
Name	Value
_strip 	<function _strip at 0xb57116bc>
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	u'\n '
directives 	[]
idx 	0
kind 	'TEXT'
match_templates 	[(<function _test at 0xb677641c>, <Path "child::body">, [('START', ...
namespaces 	{'': u'http://www.w3.org/1999/xhtml', u'py': ...
path 	<Path "child::body">
pos 	('wiki_diff.html', 42, -1)
self 	<MarkupTemplate "wiki_diff.html">
stream 	<generator object at 0xb6798f2c>
tail 	[]
template 	[('START', (u'{http://www.w3.org/1999/xhtml}body', []), (u'layout.html', ...
test 	<function _test at 0xb677641c>
# File "build/bdist.linux-i686/egg/genshi/template.py", line 1112, in _strip
Local variables:
Name	Value
data 	u'\n '
depth 	4
kind 	'TEXT'
pos 	('wiki_diff.html', 42, -1)
stream 	<generator object at 0xb679372c>
tail 	[('END', u'{http://www.w3.org/1999/xhtml}head', ('wiki_diff.html', 13, ...
# File "build/bdist.linux-i686/egg/genshi/template.py", line 902, in _eval
Local variables:
Name	Value
attrib 	[(u'class', u'time')]
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	u'\n '
event 	('TEXT', u'\n ', (u'macros.html', 121, -1))
filter_ 	<bound method MarkupTemplate._eval of <MarkupTemplate "wiki_diff.html">>
filters 	(<bound method MarkupTemplate._flatten of <MarkupTemplate ...
kind 	'TEXT'
name 	u'class'
new_attrib 	[(u'class', u'time')]
pos 	('wiki_diff.html', 42, -1)
result 	<generator object at 0xb571230c>
self 	<MarkupTemplate "wiki_diff.html">
stream 	<generator object at 0xb67932ec>
subdata 	u'16'
subkind 	'TEXT'
subpos 	('wiki_diff.html', 35, 10)
substream 	u'time'
tag 	u'{http://www.w3.org/1999/xhtml}dd'
value 	u'time'
values 	[u'16']
x 	u'16'
# File "build/bdist.linux-i686/egg/genshi/template.py", line 960, in _flatten
Local variables:
Name	Value
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	([<WithDirective>], [('START', (u'{http://www.w3.org/1999/xhtml}dl', ...
directives 	[<WithDirective>]
event 	('TEXT', u'\n ', ('wiki_diff.html', 42, -1))
kind 	'SUB'
pos 	('wiki_diff.html', 56, 6)
self 	<MarkupTemplate "wiki_diff.html">
stream 	<listiterator object at 0xb67934cc>
substream 	<generator object at 0xb5712a8c>
# File "build/bdist.linux-i686/egg/genshi/template.py", line 960, in _flatten
Local variables:
Name	Value
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	([<ChooseDirective>], [('START', (u'{http://www.w3.org/1999/xhtml}dd', ...
directives 	[<ChooseDirective>]
event 	('TEXT', u'\n ', ('wiki_diff.html', 42, -1))
kind 	'SUB'
pos 	('wiki_diff.html', 45, 8)
self 	<MarkupTemplate "wiki_diff.html">
stream 	<generator object at 0xb5712a8c>
substream 	<generator object at 0xb57126cc>
# File "build/bdist.linux-i686/egg/genshi/template.py", line 959, in _flatten
Local variables:
Name	Value
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
data 	([<WhenDirective "date">], [('EXPR', <Expression ...
directives 	[<WhenDirective "date">]
kind 	'SUB'
pos 	('wiki_diff.html', 43, 101)
self 	<MarkupTemplate "wiki_diff.html">
stream 	<generator object at 0xb57126cc>
substream 	[('EXPR', <Expression "format_datetime(change.date)">, ('wiki_diff.html', ...
# File "build/bdist.linux-i686/egg/genshi/template.py", line 207, in _apply_directives
Local variables:
Name	Value
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
directives 	[<WhenDirective "date">]
stream 	[('EXPR', <Expression "format_datetime(change.date)">, ('wiki_diff.html', ...
# File "build/bdist.linux-i686/egg/genshi/template.py", line 682, in __call__
Local variables:
Name	Value
ctxt 	[{'_choose.matched': False}, {'multi': False}, {'all': <function all at ...
directives 	[]
frame 	{'_choose.matched': False}
matched 	False
self 	<WhenDirective "date">
stream 	<listiterator object at 0xb56f24cc>
# File "build/bdist.linux-i686/egg/genshi/eval.py", line 104, in evaluate 

This is with Trac r4463, Genshi 0.3.6, Pygments 0.5.1.

It seems it might have something to do with the calling of the stream filters that trac.web.chrome.Chrome() adds to the Genshi stream, but I'm not entirely sure.

Attachments (0)

Change History (3)

comment:1 by mankoff, 18 years ago

Cc: mankoff@… added

comment:2 by Christian Boos, 18 years ago

Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

Well, it would have helped to make the actual error message more apparent: TypeError: function takes exactly 3 arguments (0 given) in File "build/bdist.linux-i686/egg/genshi/eval.py", line 104, in evaluate, but the last stack frame was indeed helpful.

comment:3 by Christian Boos, 18 years ago

Resolution: fixed
Status: assignedclosed

Fixed by r4469.

Well, Genshi 0.3.6 is still automatically calling "callables", that's why this error was apparent for you. The date in the "when" directive was actually the datetime.date

Thanks for the report!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.