Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7769 closed defect (fixed)

Custom non-required Select fields that are empty cause notification to fail

Reported by: kbogert@… Owned by: Remy Blank
Priority: normal Milestone: 0.11.3
Component: notification Version: 0.11.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Similar to #929, I get the following traceback when making changes to a ticket:

File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/ticket/web_ui.py", line 992, in _do_save
 tn.notify(ticket, newticket=False, modtime=now) 
File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/ticket/notification.py", line 139, in notify
 self.data.update({ 
File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/ticket/notification.py", line 159, in format_props
 error(self, u"f is: %s" % str(f)) AttributeError: 'NoneType' object has no attribute 'find'

The field it is erroring on is a custom select that for this specific ticket is blank.

The attached patch fixes it for me, but it seems like this would be more prevalent since that line was changed back in [1832]. I have a number of plugins installed, including agilo.

Attachments (1)

notification.diff (497 bytes ) - added by kbogert@… 16 years ago.

Download all attachments as: .zip

Change History (7)

by kbogert@…, 16 years ago

Attachment: notification.diff added

comment:1 by kbogert@…, 16 years ago

Sorry, that traceback should be:

'NoneType' object has no attribute 'find' Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/ticket/web_ui.py", line 992, in _do_save
   tn.notify(ticket, newticket=False, modtime=now)
 File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/ticket/notification.py", line 141, in notify
   'ticket_body_hdr': self.format_hdr(),
 File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/ticket/notification.py", line 159, in format_props
   continue AttributeError: 'NoneType' object has no attribute 'find'

comment:2 by kbogert@…, 16 years ago

code is:

if fval.find('\n') != -1

not continue like that traceback says.

comment:3 by Remy Blank, 16 years ago

This has been reported again on trac-users. Jonas has suggested the following patch, which would make sense as a complement to [7463]:

  • model.py

    old new  
    109109        cursor.execute("SELECT name,value FROM ticket_custom WHERE ticket=%s",
    110110                       (tkt_id,))
    111111        for name, value in cursor:
    112             if name in custom_fields:
     112            if name in custom_fields and value is not None:
    113113                self.values[name] = value
    114114
    115115    def __getitem__(self, name):

However, I cannot reproduce the issue on current 0.11-stable. This might have already been fixed by [7463] (for custom fields, #7465) and [7570] (for core fields, #4061).

OTOH, I cannot reproduce this on 0.11.1 either. I have tried setting core and custom fields to NULL, but they are invariably set to a non-NULL value before the notification is triggered.

Do you happen to use a plugin that hides some ticket fields? The only way I could imagine how the custom field could remain NULL until notification is if the field is absent from the request, meaning that the field is not in the properties form.

comment:4 by Remy Blank, 16 years ago

Keywords: needinfo added
Owner: changed from Emmanuel Blot to Remy Blank

comment:5 by kbogert@…, 16 years ago

Possibly, I would guess agilo does something like that.

Here is our list of plugins:

Let me know if you need any more information.

comment:6 by Remy Blank, 16 years ago

Keywords: needinfo removed
Milestone: 0.11.3
Resolution: fixed
Status: newclosed

I bet on Agilo, as it seems to remove fields from the ticket page. I actually had to disable the validation of ticket fields in Trac to be able to reproduce the issue!

Anyway, it's fixed now in [7720]. Thanks for the bug report.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.