Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#10709 closed defect (fixed)

Exception while rendering a diff file

Reported by: rjollos Owned by: ejucovy
Priority: normal Component: PermRedirectPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description (last modified by rjollos)

I was investigating 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:

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, 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.

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:

Attachments (1)

traceback (9.9 KB) - added by anonymous 2 years ago.

Download all attachments as: .zip

Change History (8)

Changed 2 years ago by anonymous

comment:1 Changed 2 years ago by rjollos

The issue was confirmed with the latest version of the trunk code.

comment:2 Changed 2 years ago by ejucovy

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

(In [12446]) fixes #10709 -- don't explode with a system error if sys.exc_info()[0] is None. also, add some logging code in that situation, because i don't understand when it happens.

comment:3 Changed 2 years ago by ejucovy

I can't reproduce this on a fresh Trac environment (trunk@11483 with no custom components other than permredirect) so let me know if this doesn't fix the issue for you.

comment:4 Changed 2 years ago by rjollos

Thanks for the fix. I'll do some testing soon and get back to you.

comment:5 Changed 2 years ago by rjollos

  • Description modified (diff)

comment:6 Changed 2 years ago by rjollos

  • Summary changed from Exception while rendering a patch file to Exception while rendering a diff file

comment:7 Changed 2 years ago by rjollos

The issue seems to be fixed now. Sorry I don't have more info on what the cause might have been. I'll let you know if I come across a case where the debug info you added gets logged.

Add Comment

Modify Ticket

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