Ticket #10439 (reopened defect)

Opened 8 months ago

AttributeError: 'NoneType' object has no attribute 'get_path_url' after enabling ContextMenuPlugin.*

Reported by: Assigned to: Matthew.Wild@stfc.ac.uk rjollos normal ContextMenuPlugin blocker 0.12

After installing and enabling the ContextMenuPlugin and looking at the 'Browse Source' page, I get this error

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

The trace is

File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 511, in _dispatch_request
dispatcher.dispatch(req)
File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 258, in dispatch
content_type)
File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 840, in render_template
stream |= self._filter_stream(req, method, filename, stream, data)
File "/usr/lib/python2.7/site-packages/genshi/core.py", line 132, in __or__
return Stream(_ensure(function(self)), serializer=self.serializer)
File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 991, in inner
data)
content = SubversionLink(self.env).get_content(req, data['path'], stream, data)
return tag.a(_('Subversion'), href=repos.get_path_url(path, None))


System information:

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4

Trac	0.12.2
Babel	0.9.5
Genshi	0.6
mod_wsgi	3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
pysqlite	2.6.0
Python	2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC]
setuptools	0.6
SQLite	3.7.5
Subversion	1.6.19 (r1383947)
jQuery	1.4.2


Enabled plugins:

Attachment-Policy-Plugin	0.1.0	/usr/local/lib/python2.7/site-packages/Attachment_Policy_Plugin-0.1.0-py2.7.egg
FootNoteMacro	1.03-r10434	/usr/local/lib/python2.7/site-packages/FootNoteMacro-1.03_r10434-py2.7.egg
graphviz	0.7.5	/usr/local/lib/python2.7/site-packages/graphviz-0.7.5-py2.7.egg
OverlayView	0.12.0.3	/usr/local/lib/python2.7/site-packages/OverlayView-0.12.0.3-py2.7.egg
TagPublic	0.0.1	/usr/local/lib/python2.7/site-packages/TagPublic-0.0.1-py2.7.egg
TicketGuidelinesPlugin	0.1-r514	/usr/local/lib/python2.7/site-packages/TicketGuidelinesPlugin-0.1_r514-py2.7.egg
TracAccountManager	0.3.2	/usr/local/lib/python2.7/site-packages/TracAccountManager-0.3.2-py2.7.egg
TracMasterTickets	3.0.2	/usr/local/lib/python2.7/site-packages/TracMasterTickets-3.0.2-py2.7.egg
TracNav	4.1	/usr/local/lib/python2.7/site-packages/TracNav-4.1-py2.7.egg
TracPermRedirect	2.0	/usr/local/lib/python2.7/site-packages/TracPermRedirect-2.0-py2.7.egg
TracSectionEditPlugin	0.2.6-r11208	/usr/local/lib/python2.7/site-packages/TracSectionEditPlugin-0.2.6_r11208-py2.7.egg
TracSubTicketsPlugin	0.1.0	/usr/local/lib/python2.7/site-packages/TracSubTicketsPlugin-0.1.0-py2.7.egg
TracTags	0.6	/usr/local/lib/python2.7/site-packages/TracTags-0.6-py2.7.egg
TracWikiPrintPlugin	1.9.2	/usr/local/lib/python2.7/site-packages/TracWikiPrintPlugin-1.9.2-py2.7.egg
TracWysiwyg	0.12.0.4-r11158	/usr/local/lib/python2.7/site-packages/TracWysiwyg-0.12.0.4_r11158-py2.7.egg


Change History

10/05/12 18:33:02 changed by rjollos

• description changed.

10/06/12 01:56:24 changed by rjollos

• owner changed from penmark to rjollos.
• status changed from new to assigned.

I can reproduce. I hope to have a fix available shortly.

(follow-up: ↓ 10 ) 10/06/12 03:32:03 changed by rjollos

I'm going to check-in some code that cleans things up. However, I'm not sure what is causing your problem, and I probably haven't fixed it yet. Could you send the details from trac.ini or webadmin page of how you configured your repositories?

10/06/12 03:37:12 changed by rjollos

(In [12116]) Refs #10439:

• The Subversionlink is not shown in the context menu if the URL is not set for the repository.
• Some code refactoring.
• Modified entry point.
• Extracted some common code into get_repository_path_and_rev.
• The repository is now obtained from the data dictionary passed to ITemplateStreamProvider.filter_stream(...).

10/06/12 03:44:59 changed by rjollos

(In [12117]) Refs #10439: Moved license description from source files to the added COPYING file.

(follow-up: ↓ 11 ) 10/07/12 21:27:40 changed by rjollos

I can reproduce in the case that the repository is not correctly configured. I'll add some code to protect against that. Please report back if the latest revision is working for you now.

The Wiki Link (to copy) functionality doesn't appear to have been finished. I don't see any code for copying the data to the clipboard. We can work on that in another ticket.

10/07/12 21:33:29 changed by rjollos

(In [12126]) Refs #10439:

• Check if repository object exists before trying to call a method of it. This should protect against tracebacks when the repository is not correctly configured.
• Refactoring:
• Removed some unused imports.
• Finished moving license text, which was started in [12117].

10/07/12 21:33:47 changed by rjollos

• status changed from assigned to closed.
• resolution set to fixed.

10/07/12 21:35:44 changed by rjollos

(In [12127]) Refs #10439: Fixed indentation.

(in reply to: ↑ 3 ) 10/08/12 17:38:00 changed by Matthew.Wild@stfc.ac.uk

I'm going to check-in some code that cleans things up. However, I'm not sure what is causing your problem, and I probably haven't fixed it yet. Could you send the details from trac.ini or webadmin page of how you configured your repositories?

The repository is set up using direct-svnfs as the svn is only served via http.

(in reply to: ↑ 6 ) 10/08/12 17:42:32 changed by Matthew.Wild@stfc.ac.uk

I can reproduce in the case that the repository is not correctly configured. I'll add some code to protect against that. Please report back if the latest revision is working for you now.

Yes, the latest version seems to work, at least it doesn't crash!

Unfortunately, I don't actually get any of the buttons on the 'Browse Source' page once I add the TracBrowserSvnOperations plugin, which is why I needed the ContextMenuPlugin.

This may be because of the use of direct-svnfs to access the repository.

(follow-up: ↓ 13 ) 10/10/12 00:54:38 changed by rjollos

• status changed from closed to reopened.
• resolution deleted.

Okay, let me test with your configuration and get back to you. Could you post the repositories and trac sections of your trac.ini? Do you have only a single repository?

(in reply to: ↑ 12 ) 10/10/12 10:04:18 changed by Matthew.Wild@stfc.ac.uk

Okay, let me test with your configuration and get back to you. Could you post the repositories and trac sections of your trac.ini? Do you have only a single repository?

Yes, just the single repository.

trac:

[trac]
authz_file = /docs/ukssdc/www/vhosts/espas-trac/espas/conf/authzpolicy.conf
authz_module_name =
auto_preview_timeout = 2.0
backup_dir = db
base_url = http://www.espas-fp7.eu/trac
check_auth_ip = false
database = sqlite:db/trac.db
debug_sql = False
default_charset = iso-8859-15
genshi_cache_size = 128
htdocs_location =
ignore_auth_case = false
mysqldump_path = mysqldump
never_obfuscate_mailto = false
permission_policies = AttachmentDeletePolicy, TagPublic, AuthzPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
permission_store = DefaultPermissionStore
pg_dump_path = pg_dump
repository_dir =
repository_sync_per_request = (default)
repository_type = svn
resizable_textareas = true
timeout = 20
use_base_url_for_redirect = False


There is no repositories section.

Add/Change #10439 (AttributeError: 'NoneType' object has no attribute 'get_path_url' after enabling ContextMenuPlugin.*)

Change Properties