Opened 11 years ago

Last modified 11 years ago

#10709 closed defect

Exception while rendering a patch file — at Initial Version

Reported by: Ryan J Ollos Owned by: ejucovy
Priority: normal Component: PermRedirectPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I was investigating Bloodhound issue #308, and trying to determine why .patch files rendered with syntax highlighting, but .diff did not. The issue I'm reporting here appears to be unrelated. During the rendering of .diff files I saw the following traceback:

Traceback (most recent call last):
  File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 236, in dispatch
    self._post_process_request(req)
  File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 340, in _post_process_request
    f.post_process_request(req, *(None,)*extra_arg_count)
  File "/home/user/Workspace/trac-hacks/permredirectplugin/trunk/permredirect/filter.py", line 59, in post_process_request
    if issubclass(exctype, PermissionError):
TypeError: issubclass() arg 1 must be a class

Full traceback is attached. To reproduce, attached a file ending in .patch to a ticket and then view the file. You may be able to reproduce under other circumstances as well ... I haven't investigated thoroughly.

I'm not sure what the correct fix is, but the following patch makes the exception go away:

  • permredirectplugin/trunk/permredirect/filter.py

     
    5656                ref_url = ref_url + "?" + req.query_string
    5757            login_url = req.href.login(referer=ref_url)
    5858
    59             if issubclass(exctype, PermissionError):
     59            if exctype and issubclass(exctype, PermissionError):
    6060                req.redirect(login_url)
    6161           
    6262            try:

Change History (1)

Changed 11 years ago by anonymous

Attachment: traceback added
Note: See TracTickets for help on using tickets.