Modify

Opened 6 years ago

Closed 2 years ago

Last modified 2 years ago

#3505 closed defect (wontfix)

Exception in post_process_request on permission error

Reported by: rblank Owned by: coderanger
Priority: low Component: WikiRenamePlugin
Severity: minor Keywords: patch
Cc: Trac Release: 0.11

Description

When trying to view a wiki page while not having the permissions to do so, the plugin throws in post_process_request():

2008-08-02 22:53:05,837 Trac[main] WARNING: 403 Forbidden (WIKI_VIEW privileges are required to perform this operation on WikiStart)
2008-08-02 22:53:29,882 Trac[main] ERROR: 'NoneType' object is unsubscriptable
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 233, in dispatch
    self._post_process_request(req)
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 301, in _post_process_request
    f.post_process_request(req, *(None,)*extra_arg_count)
  File "build/bdist.linux-i686/egg/wikirename/web_ui.py", line 64, in post_process_request
    page = data['page']
TypeError: 'NoneType' object is unsubscriptable

This is due to the fact that data is None when an exception is raised in process_request(). The following patch fixes the problem:

Index: wikirename/web_ui.py
===================================================================
--- wikirename/web_ui.py        (revision 4098)
+++ wikirename/web_ui.py        (working copy)
@@ -60,11 +60,11 @@
         return handler

     def post_process_request(self, req, template, data, content_type):
-        if req.path_info.startswith('/wiki') or req.path_info == '/':
+        if data is not None and (req.path_info.startswith('/wiki') or req.path_info == '/'):
             page = data['page']
             perm = req.perm(page.resource)
             if 'WIKI_RENAME' in perm or 'WIKI_ADMIN' in perm:

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by rjollos

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

The plugin is deprecated since there is now support in the Trac core.

comment:2 Changed 2 years ago by rjollos

If you'd like to apply patches I can provide you commit access.

Add Comment

Modify Ticket

Action
as closed The owner will remain coderanger.
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.