[Trac-tickets] Re: [The Trac Project] #1579: Can't modify ticket

The Trac Project noreply at edgewall.com
Thu Jun 2 21:29:00 CDT 2005


#1579: Can't modify ticket
---------------------------+------------------------------------------------
       Id:  1579           |      Status:  assigned                
Component:  ticket system  |    Modified:  Thu Jun  2 21:28:59 2005
 Severity:  critical       |   Milestone:                          
 Priority:  highest        |     Version:  devel                   
    Owner:  cmlenz         |    Reporter:  markb                   
---------------------------+------------------------------------------------
Changes (by odela01 at ca.com):

  * cc:  => odela01 at ca.com

Comment:

 I'm not sure why the email notification is failing, although using a ; to
 separate email addresses appears to be one cause.

 The actual exception is because the log statement expects the ticket['id']
 to be an int, but it's a string at that point. I think the culprit is line
 221 of Notify.py: {{{
tkt['id'] = '%s' % tkt['id']}}}, where tkt is a
 reference to the original ticket object that was passed to the notify
 method. I have applied the following patch, and it seems to work:

 {{{
 --- Notify.py.orig      Fri Jun  3 16:59:51 2005
 +++ Notify.py   Fri Jun  3 17:00:41 2005
 @@ -218,7 +218,6 @@

      def format_props(self):
          tkt = self.ticket
 -        tkt['id'] = '%s' % tkt['id']
          t = self.modtime or tkt['time']
          tkt['modified'] = time.strftime('%c', time.localtime(t))
          fields = ['id',        'status',
 @@ -252,7 +251,7 @@
          big=[]
          for f in fields:
              if not tkt.has_key(f): continue
 -            fval = tkt[f]
 +            fval = str(tkt[f])
              fname = f.startswith('custom_') and f[7:] or f
              if '\n' in str(fval):
                  big.append((fname.capitalize(), fval))
 }}}

 After that is done, the log call works correctly. The stack trace of the
 email notification failure is now logged:

 {{{
 17:11:16 Trac[web_ui] ERROR: Failure sending notification on change to
 ticket #165: len() of unsized object
 Traceback (most recent call last):
   File "/usr/local/lib/python2.3/site-packages/trac/ticket/web_ui.py",
 line 347, in _do_save
     tn.notify(ticket, newticket=0, modtime=now)
   File "/usr/local/lib/python2.3/site-packages/trac/Notify.py", line 217,
 in notify
     NotifyEmail.notify(self, ticket['id'], subject)
   File "/usr/local/lib/python2.3/site-packages/trac/Notify.py", line 117,
 in notify
     Notify.notify(self, resid)
   File "/usr/local/lib/python2.3/site-packages/trac/Notify.py", line 56,
 in notify
     self.send(to)
   File "/usr/local/lib/python2.3/site-packages/trac/Notify.py", line 347,
 in send
     NotifyEmail.send(self, rcpt, hdrs)
   File "/usr/local/lib/python2.3/site-packages/trac/Notify.py", line 150,
 in send
     self.server.sendmail(self.from_email, rcpt, msg.as_string())
   File "/usr/local/lib/python2.3/email/Message.py", line 130, in as_string
     g.flatten(self, unixfrom=unixfrom)
   File "/usr/local/lib/python2.3/email/Generator.py", line 103, in flatten
     self._write(msg)
   File "/usr/local/lib/python2.3/email/Generator.py", line 138, in _write
     self._write_headers(msg)
   File "/usr/local/lib/python2.3/email/Generator.py", line 184, in
 _write_headers
     header_name=h, continuation_ws='\t').encode()
   File "/usr/local/lib/python2.3/email/Header.py", line 412, in encode
     newchunks += self._split(s, charset, targetlen, splitchars)
   File "/usr/local/lib/python2.3/email/Header.py", line 297, in _split
     elen = charset.encoded_header_len(encoded)
   File "/usr/local/lib/python2.3/email/Charset.py", line 341, in
 encoded_header_len
     return len(s)
 TypeError: len() of unsized object
 }}}

 I haven't had a chance to look into this yet. Hope that helps.

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/1579>
The Trac Project <>


More information about the Trac-Tickets mailing list