Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#6329 closed defect (fixed)

InterTrac request for page named with national character fail

Reported by: tonal@… Owned by: Christian Boos
Priority: high Milestone: 0.11
Component: general Version: devel
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

InterTrac request for page named with national character fail. Error report:

Oops… Trac detected an internal error:

TypeError: extract_link() takes exactly 3 arguments (2 given)

If you think this should work you can reproduce the problem, you should consider reporting this to the Trac team.

Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket.

Otherwise, please

How to Reproduce

While doing a GET operation on /intertrac/wiki:ЮрДок, Trac issued an internal error. (please provide additional details here) Request parameters: {'link': u'wiki:\u042e\u0440\u0414\u043e\u043a'}

System Information

Trac 0.11dev-r6139
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)]
setuptools 0.6c7
SQLite 3.4.2
pysqlite 2.3.4
Genshi 0.5dev-r766
Subversion 1.4.4 (r25188)

Python Traceback

Traceback (most recent call last): 
File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/main.py", line 386, in dispatch_request dispatcher.dispatch(req) 
File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/main.py", line 195, in dispatch resp = chosen_handler.process_request(req) 
File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/wiki/intertrac.py", line 45, in process_request link_elt = extract_link(Context(self.env, req), link) 
TypeError: extract_link() takes exactly 3 arguments (2 given) }}} a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it.

Python Traceback
Most recent call last:

    * File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/main.py", line 386, in dispatch_request
      Code fragment:
       381. try:
       382. if not env and env_error:
       383. raise HTTPInternalError(env_error)
       384. try:
       385. dispatcher = RequestDispatcher(env)
       386. dispatcher.dispatch(req)
       387. except RequestDone:
       388. pass
       389. resp = req._response or []
       390.  
       391. except HTTPException, e:
      Local variables:
      Name	Value
      after 	[' except RequestDone:', ' pass', ' resp = ...
      before 	[' try:', ' if not env and env_error:', ' raise ...
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x8cbbcac>
      e 	TypeError('extract_link() takes exactly 3 arguments (2 given)',)
      env 	<trac.env.Environment object at 0x8c8584c>
      env_error 	None
      env_name 	'mun-obr'
      env_parent_dir 	'/home/dk/trac'
      env_path 	'/home/dk/trac/mun-obr'
      env_paths 	None
      environ 	{'HTTP_AUTHORIZATION': 'Digest username="tonal", realm="promsoft.ru", ...
      exc_info 	(<type 'exceptions.TypeError'>, TypeError('extract_link() takes exactly 3 ...
      filename 	'/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/mai ...
      frames 	[{'function': 'dispatch_request', 'lines_before': [' try:', ' if ...
      has_admin 	True
      line 	' dispatcher.dispatch(req)'
      lineno 	385
      message 	u'TypeError: extract_link() takes exactly 3 arguments (2 given)'
      path_info 	['intertrac', 'wiki:\xd0\xae\xd1\x80\xd0\x94\xd0\xbe\xd0\xba']
      req 	<Request "GET u'/intertrac/wiki:\u042e\u0440\u0414\u043e\u043a'">
      resp 	[]
      run_once 	False
      script_url 	None
      start_response 	<bound method WSGIServerGateway._start_response of ...
      tb 	<traceback object at 0x8d5ab1c>
      tb_hide 	None
      traceback 	'Traceback (most recent call last):\n File ...
    * File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/main.py", line 195, in dispatch
      Code fragment:
       190. req.args.get('__FORM_TOKEN') != req.form_token:
       191. raise HTTPBadRequest('Missing or invalid form token. '
       192. 'Do you have cookies enabled?')
       193.  
       194. # Process the request and render the template
       195. resp = chosen_handler.process_request(req)
       196. if resp:
       197. if len(resp) == 2: # Clearsilver
       198. chrome.populate_hdf(req)
       199. template, content_type = \
       200. self._post_process_request(req, *resp)
      Local variables:
      Name	Value
      chosen_handler 	<trac.wiki.intertrac.InterTracDispatcher object at 0x8cb320c>
      chrome 	<trac.web.chrome.Chrome object at 0x8cbb18c>
      err 	(<type 'exceptions.TypeError'>, TypeError('extract_link() takes exactly 3 ...
      handler 	<trac.wiki.intertrac.InterTracDispatcher object at 0x8cb320c>
      req 	<Request "GET u'/intertrac/wiki:\u042e\u0440\u0414\u043e\u043a'">
      self 	<trac.web.main.RequestDispatcher object at 0x8cbbcac>
    * File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/wiki/intertrac.py", line 45, in process_request
      Code fragment:
        40. req.args['link'] = match.group(1)
        41. return True
        42.  
        43. def process_request(self, req):
        44. link = req.args.get('link', '')
        45. link_elt = extract_link(Context(self.env, req), link)
        46. if isinstance(link_elt, Element):
        47. href = link_elt.attrib.get('href')
        48. else:
        49. href = req.href(link)
        50. req.redirect(href)
      Local variables:
      Name	Value
      link 	u'wiki:\u042e\u0440\u0414\u043e\u043a'
      req 	<Request "GET u'/intertrac/wiki:\u042e\u0440\u0414\u043e\u043a'">
      self 	<trac.wiki.intertrac.InterTracDispatcher object at 0x8cb320c>

File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/main.py", line 386, in dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/web/main.py", line 195, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6139-py2.5.egg/trac/wiki/intertrac.py", line 45, in process_request
  link_elt = extract_link(Context(self.env, req), link)

System Information:

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
Trac: 	0.11dev-r6139
Python: 	2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)]
setuptools: 	0.6c7
SQLite: 	3.4.2
pysqlite: 	2.3.4
Genshi: 	0.5dev-r766
Subversion: 	1.4.4 (r25188)
jQuery:	1.1.3.1

Attachments (1)

err_report.ticket.zip (1.3 KB ) - added by tonal@… 16 years ago.
in zip file my answer

Download all attachments as: .zip

Change History (10)

comment:1 by Emmanuel Blot, 16 years ago

Description: modified (diff)
Version: devel

Fixing the traceback (semi-automatic trace report did not help…)

comment:2 by Christian Boos, 16 years ago

Milestone: 0.11
Owner: changed from Jonas Borgström to Christian Boos
Priority: normalhigh
Severity: normaltrivial

Hm, that was an old style extract_link call.

I'll also check the semi-automatic bug reporting feature.

comment:3 by Christian Boos, 16 years ago

Description: modified (diff)
Resolution: fixed
Status: newclosed
Summary: IterTrac request for page named with national character failInterTrac request for page named with national character fail

Fixed in [6143].

comment:4 by tonal@…, 16 years ago

Resolution: fixed
Status: closedreopened

In version Trac 0.11dev-r6149 error if not login to target track:

Oops…
Trac detected an internal error:

AttributeError: 'NoneType' object has no attribute 'startswith'

There was an internal error in Trac. It is recommended that you inform your local Trac administrator and give him all the information he needs to reproduce the issue.

To that end, you could ==== How to Reproduce ==== While doing a GET operation on `/intertrac/wiki:ОсновныеСущностиСистемы`, Trac issued an internal error. ''(please provide additional details here)'' Request parameters: {{{ {'link': u'wiki:\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435\u0421\u0443\u0449\u043d\u043e\u0441\u0442\u0438\u0421\u0438\u0441\u0442\u0435\u043c\u044b'} }}} ==== System Information ==== || '''Trac''' || `0.11dev-r6149` || || '''Python''' || `2.5.1 (r251:54863, Oct 5 2007, 13:36:32) ` [[br]] `[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)]` || || '''setuptools''' || `0.6c7` || || '''SQLite''' || `3.4.2` || || '''pysqlite''' || `2.3.4` || || '''Genshi''' || `0.5dev-r766` || || '''Subversion''' || `1.4.4 (r25188)` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6149-py2.5.egg/trac/web/main.py", line 386, in dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6149-py2.5.egg/trac/web/main.py", line 195, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6149-py2.5.egg/trac/wiki/intertrac.py", line 50, in process_request req.redirect(href) File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6149-py2.5.egg/trac/web/api.py", line 278, in redirect if not url.startswith('http://') and not url.startswith('https://'): AttributeError: 'NoneType' object has no attribute 'startswith' }}} a ticket at this site.

The action that triggered the error was:

GET: /intertrac/wiki:ОсновныеСущностиСистемы

comment:5 by Christian Boos, 16 years ago

Keywords: needinfo added

Sorry, I don't understand how href could be None in source:trunk/trac/wiki/intertrac.py@6149#L50.

Would it be possible for you to add a couple of print statements in the lines above to get more details about the issue?

I can't do it myself, as your example works fine for me.

comment:6 by tonal@…, 16 years ago

Thes error do not dependence national characters - see attached file err_repert.txt

by tonal@…, 16 years ago

Attachment: err_report.ticket.zip added

in zip file my answer

comment:7 by tonal@…, 16 years ago

Privilege in my track

admin:

BROWSER_VIEW, CHANGESET_VIEW, CONFIG_VIEW, FILE_VIEW, LOG_VIEW, MILESTONE_ADMIN, MILESTONE_CREATE, MILESTONE_DELETE, MILESTONE_MODIFY, MILESTONE_VIEW, REPORT_ADMIN, REPORT_CREATE, REPORT_DELETE, REPORT_MODIFY, REPORT_SQL_VIEW, REPORT_VIEW, ROADMAP_ADMIN, ROADMAP_VIEW, SEARCH_VIEW, TICKET_ADMIN, TICKET_APPEND, TICKET_CHGPROP, TICKET_CREATE, TICKET_MODIFY, TICKET_VIEW, TIMELINE_VIEW, TRAC_ADMIN, WIKI_ADMIN, WIKI_CREATE, WIKI_DELETE, WIKI_MODIFY, WIKI_VIEW

authenticated:

TICKET_CREATE, TICKET_MODIFY, WIKI_CREATE, WIKI_MODIFY

customer:

MILESTONE_VIEW, REPORT_VIEW, ROADMAP_VIEW, SEARCH_VIEW, TICKET_APPEND, TICKET_CREATE, TICKET_VIEW, TIMELINE_VIEW, WIKI_VIEW

user:

BROWSER_VIEW, CHANGESET_VIEW, FILE_VIEW, LOG_VIEW, MILESTONE_VIEW, REPORT_VIEW, ROADMAP_VIEW, SEARCH_VIEW, TICKET_APPEND, TICKET_CHGPROP, TICKET_CREATE, TICKET_MODIFY, TICKET_VIEW, TIMELINE_VIEW, WIKI_CREATE, WIKI_DELETE, WIKI_MODIFY, WIKI_VIEW

tonal:

admin

comment:8 by Christian Boos, 16 years ago

Keywords: needinfo removed
Severity: trivialminor

Sorry, forgot to update the ticket: yes, the problem is triggered when there's no permission to view or create the targeted page. Then, there's no <a> element given back by the extract_link, but a <span> with some error message.

comment:9 by Christian Boos, 16 years ago

Resolution: fixed
Status: reopenedclosed

Should be fixed in [6199].

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.