Modify ↓
#3505 closed defect (wontfix)
Exception in post_process_request on permission error
Reported by: | Remy Blank | Owned by: | Noah Kantrowitz |
---|---|---|---|
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)
Note: See
TracTickets for help on using
tickets.
The plugin is deprecated since there is now support in the Trac core.