Modify

Opened 16 years ago

Closed 11 years ago

#4154 closed defect (fixed)

privateticketsplugin fails in /report/1 after update to Trac 0.11.2.1 from 0.11.1

Reported by: roh <roh@…> Owned by: Ryan J Ollos
Priority: normal Component: PrivateTicketsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

system is debian etch, trac via easy_install, run in lighttpd (fcgi) with accountmanager, tractags, simpletickets plugins.

debug output:

2008-11-25 02:52:22,238 Trac[__init__] ERROR: 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/web/main.py", line 432, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/web/main.py", line 204, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/ticket/report.py", line 105, in process_request
    template, data, content_type = self._render_view(req, db, id)
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/ticket/report.py", line 436, in _render_view
    if resource.realm.upper()+'_VIEW' not in req.perm(resource):
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/perm.py", line 523, in has_permission
    return self._has_permission(action, resource)
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/perm.py", line 536, in _has_permission 
    decision = PermissionSystem(self.env). \
  File "/usr/local/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/perm.py", line 424, in check_permission
    perm)
  File "build/bdist.linux-i686/egg/privatetickets/policy.py", line 44, in check_permission
  File "build/bdist.linux-i686/egg/privatetickets/policy.py", line 71, in check_ticket_access
AttributeError: 'NoneType' object has no attribute 'split' 

i am not totally sure this is the correct fix, but it works for me as a hotfix

Index: privatetickets/policy.py
===================================================================
--- privatetickets/policy.py	(revision 4870)
+++ privatetickets/policy.py	(working copy)
@@ -68,8 +68,10 @@
         
         if perm.has_permission('TICKET_VIEW_CC'):
             had_any = True
-            if perm.username in [x.strip() for x in tkt['cc'].split(',')]:
-                return None
+#	    self.log.debug('Private: TICKET_VIEW_CC "%s", "%s"', perm.username, tkt['cc'])
+	    if tkt['cc'] is not None:
+                if perm.username in [x.strip() for x in tkt['cc'].split(',')]:
+                    return None
         
         if perm.has_permission('TICKET_VIEW_OWNER'):
             had_any = True

Attachments (0)

Change History (7)

comment:1 Changed 13 years ago by Ryan J Ollos

Owner: changed from Noah Kantrowitz to Ryan J Ollos
Status: newassigned

Here's another report of the same issue: t:#8430. With Trac 0.12, the CC field is an empty string if no data has been entered. I'm not sure what conditions will lead to this field being NULL in the database, but perhaps it was an issue with an earlier version of Trac. There are some related defects for the keywords field that I'll read up on and post any relevant content here.

comment:2 Changed 13 years ago by Ryan J Ollos

(In [11488]) Refs #4154: Use the Chrome.cc_list function to parse the ticket['cc'] string into a list, since it will handle the case that ticket['cc'] is None, which presumably would arise from having a NULL entry in the database. It is not clear when this might happen since an empty cc field results in the return of an empty string in Trac 0.12, but the issue has been reported by multiple users.

comment:3 Changed 13 years ago by Ryan J Ollos

Another advantage of the change in [11488] is in avoiding assumptions about how Trac stores the CC list. In Trac 0.12.0 and earlier, the cc_list function splits the email address string at commas. In Trac 0.12.1 and later, cc_list splits the string at commas and semicolons. The change was made in ticket t:#9522 (changeset [t 10023]).

Here is the relevant code:

This function exists back to Trac 0.11.0, and possibly earlier.

comment:4 Changed 13 years ago by Ryan J Ollos

This ticket will be left open for feedback and resolved with milestone 2.1 (#9964).

comment:5 Changed 13 years ago by Ryan J Ollos

(In [11490]) Refs #4154: Set version to 2.1dev.

comment:6 Changed 13 years ago by Ryan J Ollos

(In [11493]) Refs #4154: Removed .settings file accidentally committed in [11488].

comment:7 Changed 11 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.