id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
10709	Exception while rendering a diff file	rjollos	ejucovy	I was investigating [https://issues.apache.org/bloodhound/ticket/308#comment:3 Bloodhound issue #308], and trying to determine why `.patch` files rendered with syntax highlighting, but `.diff` files did not. The issue I'm reporting here appears to be unrelated. During the rendering of `.diff` files I saw the following traceback:\r\n{{{\r\nTraceback (most recent call last):\r\n  File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 497, in _dispatch_request\r\n    dispatcher.dispatch(req)\r\n  File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 236, in dispatch\r\n    self._post_process_request(req)\r\n  File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 340, in _post_process_request\r\n    f.post_process_request(req, *(None,)*extra_arg_count)\r\n  File "/home/user/Workspace/trac-hacks/permredirectplugin/trunk/permredirect/filter.py", line 59, in post_process_request\r\n    if issubclass(exctype, PermissionError):\r\nTypeError: issubclass() arg 1 must be a class\r\n}}}\r\n\r\nFull traceback is attached. To reproduce, attach a file ending in `.diff` to a ticket and then view the file. You may be able to reproduce under other circumstances as well ... I haven't investigated thoroughly.\r\n\r\nI'm not sure what the correct fix is, but the following patch makes the exception go away:\r\n{{{\r\n#!patch\r\nIndex: permredirectplugin/trunk/permredirect/filter.py\r\n===================================================================\r\n--- permredirectplugin/trunk/permredirect/filter.py_(revision 12442)\r\n+++ permredirectplugin/trunk/permredirect/filter.py_(working copy)\r\n@@ -56,7 +56,7 @@\r\n                 ref_url = ref_url + "?" + req.query_string\r\n             login_url = req.href.login(referer=ref_url)\r\n \r\n-            if issubclass(exctype, PermissionError):\r\n+            if exctype and issubclass(exctype, PermissionError):\r\n                 req.redirect(login_url)\r\n             \r\n             try:\r\n}}}	defect	closed	normal	PermRedirectPlugin	normal	fixed			1.0
