Modify

Opened 5 years ago

Last modified 2 years ago

#10439 new defect

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

Reported by: Matthew.Wild@… Owned by: Ryan J Ollos
Priority: normal Component: ContextMenuPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

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)
File "/usr/local/lib/python2.7/site-packages/ContextMenuPlugin-0.2dev_r11870-py2.7.egg/contextmenu/contextmenu.py", line 150, in filter_stream
  content = SubversionLink(self.env).get_content(req, data['path'], stream, data)
File "/usr/local/lib/python2.7/site-packages/ContextMenuPlugin-0.2dev_r11870-py2.7.egg/contextmenu/contextmenu.py", line 89, in get_content
  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
ContextMenuPlugin	0.2dev-r11870	/usr/local/lib/python2.7/site-packages/ContextMenuPlugin-0.2dev_r11870-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
IniAdmin	0.2-r10454	/usr/local/lib/python2.7/site-packages/IniAdmin-0.2_r10454-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

Attachments (0)

Change History (15)

comment:1 Changed 5 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 5 years ago by Ryan J Ollos

Owner: changed from Pontus Enmark to Ryan J Ollos
Status: newassigned

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

comment:3 Changed 5 years ago by Ryan J Ollos

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?

comment:4 Changed 5 years ago by Ryan J Ollos

(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(...).

comment:5 Changed 5 years ago by Ryan J Ollos

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

comment:6 Changed 5 years ago by Ryan J Ollos

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.

comment:7 Changed 5 years ago by Ryan J Ollos

(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.
    • Replaced use of deprecated add_javascript with add_script.
    • Finished moving license text, which was started in [12117].

comment:8 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

comment:9 Changed 5 years ago by Ryan J Ollos

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

comment:10 in reply to:  3 Changed 5 years ago by Matthew.Wild@…

Replying to 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?

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

comment:11 in reply to:  6 Changed 5 years ago by Matthew.Wild@…

Replying to 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.

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.

comment:12 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: closedreopened

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?

comment:13 in reply to:  12 Changed 5 years ago by Matthew.Wild@…

Replying to rjollos:

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]
auth_cookie_lifetime = 0
auth_cookie_path = 
authz_file = /docs/ukssdc/www/vhosts/espas-trac/espas/conf/authzpolicy.conf
authz_module_name = 
auto_preview_timeout = 2.0
auto_reload = False
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
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,prefs,help,about
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
secure_cookies = False
show_email_addresses = false
show_ip_addresses = false
timeout = 20
use_base_url_for_redirect = False

There is no repositories section.

comment:14 Changed 4 years ago by Ryan J Ollos

Status: reopenedaccepted

comment:15 Changed 2 years ago by Ryan J Ollos

Status: acceptednew

Refocusing.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Ryan J Ollos.

Add Comment


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

 
Note: See TracTickets for help on using tickets.