Modify

Opened 4 years ago

Closed 2 years ago

#8369 closed defect (duplicate)

InternalError with enabled SubversionLink options

Reported by: anonymous Owned by: penmark
Priority: high Component: ContextMenuPlugin
Severity: major Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

When I enable SubversionLink options I get an InternalError when I try view source via BrowseSource.

Trac detected an internal error:
AttributeError: 'NoneType' object has no attribute 'rstrip'

Python Traceback
Most recent call last:

    * File "build/bdist.linux-i686/egg/trac/web/main.py", line 513, in _dispatch_request
      Code fragment:
      Line	
      508	try:
      509	if not env and env_error:
      510	raise HTTPInternalError(env_error)
      511	try:
      512	dispatcher = RequestDispatcher(env)
      513	dispatcher.dispatch(req)
      514	except RequestDone:
      515	pass
      516	resp = req._response or []
      517	 
      518	except HTTPException, e:
      Local variables:
      Name	Value
      dispatcher 	<trac.web.main.RequestDispatcher object at 0xa96038c>
      e 	AttributeError("'NoneType' object has no attribute 'rstrip'",)
      env 	<trac.env.Environment object at 0xb18822c>
      env_error 	None
      req 	<Request "GET '/browser'">
      resp 	[]
    * File "build/bdist.linux-i686/egg/trac/web/main.py", line 256, in dispatch
      Code fragment:
      Line	
      251	pprint(data, out)
      252	req.send(out.getvalue(), 'text/plain')
      253	else:
      254	output = chrome.render_template(req, template,
      255	data,
      256	content_type)
      257	# Give the session a chance to persist changes
      258	req.session.save()
      259	req.send(output, content_type or 'text/html')
      260	else:
      261	self._post_process_request(req)
      Local variables:
      Name	Value
      chosen_handler 	<trac.versioncontrol.web_ui.browser.BrowserModule object at 0xabe212c>
      chrome 	<trac.web.chrome.Chrome object at 0xaeb5e8c>
      content_type 	None
      data 	{'dateinfo': <function dateinfo at 0xac8325c>, 'file': None, 'stickyrev': ...
      err 	(<type 'exceptions.AttributeError'>, AttributeError("'NoneType' object has ...
      handler 	<trac.versioncontrol.web_ui.browser.BrowserModule object at 0xabe212c>
      req 	<Request "GET '/browser'">
      resp 	('browser.html', {'dateinfo': <function dateinfo at 0xac8325c>, 'file': ...
      self 	<trac.web.main.RequestDispatcher object at 0xa96038c>
      template 	'browser.html'
    * File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 816, in render_template
      Code fragment:
      Line	
      811	 
      812	stream = template.generate(**data)
      813	 
      814	# Filter through ITemplateStreamFilter plugins
      815	if self.stream_filters:
      816	stream |= self._filter_stream(req, method, filename, stream, data)
      817	 
      818	if fragment:
      819	return stream
      820	 
      821	if method == 'text':
      Local variables:
      Name	Value
      content_type 	'text/html'
      data 	{'all': <built-in function all>, 'pprint': <function pformat at ...
      filename 	'browser.html'
      fragment 	False
      i 	0
      method 	'xhtml'
      req 	<Request "GET '/browser'">
      self 	<trac.web.chrome.Chrome object at 0xaeb5e8c>
      stream 	<genshi.core.Stream object at 0xab200cc>
      template 	<MarkupTemplate "browser.html">
      type_ 	'notices'
    * File "/usr/lib/python2.5/site-packages/Genshi-0.6-py2.5.egg/genshi/core.py", line 132, in __or__
      Code fragment:
      Line	
      127	
      128	:param function: the callable object that should be applied as a filter
      129	:return: the filtered stream
      130	:rtype: `Stream`
      131	"""
      132	return Stream(_ensure(function(self)), serializer=self.serializer)
      133	 
      134	def filter(self, *filters):
      135	"""Apply filters to the stream.
      136	
      137	This method returns a new stream with the given filters applied. The
      Local variables:
      Name	Value
      function 	<function inner at 0xafee454>
      self 	<genshi.core.Stream object at 0xab200cc>
    * File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 955, in inner
      Code fragment:
      Line	
      950	 
      951	def _filter_stream(self, req, method, filename, stream, data):
      952	def inner(stream, ctxt=None):
      953	for filter in self.stream_filters:
      954	stream = filter.filter_stream(req, method, filename, stream,
      955	data)
      956	return stream
      957	return inner
      958	 
      959	def _stream_location(self, stream):
      960	for kind, data, pos in stream:
      Local variables:
      Name	Value
      ctxt 	None
      data 	{'all': <built-in function all>, 'pprint': <function pformat at ...
      filename 	'browser.html'
      filter 	<contextmenu.contextmenu.SourceBrowserContextMenu object at 0xafb4b6c>
      method 	'xhtml'
      req 	<Request "GET '/browser'">
      self 	<trac.web.chrome.Chrome object at 0xaeb5e8c>
      stream 	<genshi.core.Stream object at 0xab200cc>
    * File "build/bdist.linux-i686/egg/contextmenu/contextmenu.py", line 155, in filter_stream
      Code fragment:
      Line	
      150	if 'path' not in data:
      151	# Probably an upstream error
      152	return stream
      153	# provide a link to the svn repository at the top of the Browse Source listing
      154	if self.env.is_component_enabled("contextmenu.contextmenu.SubversionLink"):
      155	content = SubversionLink(self.env).get_content(req, data['path'], stream, data)
      156	if content:
      157	stream |= Transformer("//div[@id='content']/h1").after(content)
      158	# No dir entries; we're showing a file
      159	if not data['dir']:
      160	return stream
      Local variables:
      Name	Value
      data 	{'all': <built-in function all>, 'pprint': <function pformat at ...
      filename 	'browser.html'
      method 	'xhtml'
      req 	<Request "GET '/browser'">
      self 	<contextmenu.contextmenu.SourceBrowserContextMenu object at 0xafb4b6c>
      stream 	<genshi.core.Stream object at 0xab200cc>
    * File "build/bdist.linux-i686/egg/contextmenu/contextmenu.py", line 90, in get_content
      Code fragment:
      Line	
      85	else:
      86	try:
      87	path = entry.path
      88	except AttributeError:
      89	path = entry['path']
      90	href = self.svn_base_url.rstrip('/')
      91	if data['reponame']:
      92	href += '/' + data['reponame']
      93	href += '/' + path
      94	return tag.a('Subversion', href=href)
      95	 
      Local variables:
      Name	Value
      data 	{'all': <built-in function all>, 'pprint': <function pformat at ...
      entry 	'/'
      path 	'/'
      req 	<Request "GET '/browser'">
      self 	<contextmenu.contextmenu.SubversionLink object at 0xad0c1cc>
      stream 	<genshi.core.Stream object at 0xab200cc>

File "build/bdist.linux-i686/egg/trac/web/main.py", line 513, in _dispatch_request
  dispatcher.dispatch(req)
File "build/bdist.linux-i686/egg/trac/web/main.py", line 256, in dispatch
  content_type)
File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 816, in render_template
  stream |= self._filter_stream(req, method, filename, stream, data)
File "/usr/lib/python2.5/site-packages/Genshi-0.6-py2.5.egg/genshi/core.py", line 132, in __or__
  return Stream(_ensure(function(self)), serializer=self.serializer)
File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 955, in inner
  data)
File "build/bdist.linux-i686/egg/contextmenu/contextmenu.py", line 155, in filter_stream
  content = SubversionLink(self.env).get_content(req, data['path'], stream, data)
File "build/bdist.linux-i686/egg/contextmenu/contextmenu.py", line 90, in get_content
  href = self.svn_base_url.rstrip('/')
System Information:
User Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20110102 Iceweasel/3.5.16 (like Firefox/3.5.16)
Trac 	0.12
Genshi 	0.6
mod_wsgi 	2.5 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
pysqlite 	2.3.2
Python 	2.5.2 (r252:60911, Jan 24 2010, 15:24:24) [GCC 4.3.2]
setuptools 	0.6c8
SQLite 	3.7.3
Subversion 	1.5.1 (r32289)
jQuery	1.4.2

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by rjollos

  • Description modified (diff)

comment:2 Changed 3 years ago by anonymous

Any solution yet? I also have this error.

comment:3 Changed 2 years ago by rjollos

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #7920.

Add Comment

Modify Ticket

Action
as closed The owner will remain penmark.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.