Opened 20 years ago
Closed 20 years ago
#1579 closed defect (fixed)
Can't modify ticket
| Reported by: | markb | Owned by: | Christopher Lenz | 
|---|---|---|---|
| Priority: | highest | Milestone: | 0.9 | 
| Component: | ticket system | Version: | devel | 
| Severity: | critical | Keywords: | |
| Cc: | odela01@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description (last modified by )
Trying to add a comment to an existing ticket doesn't work. After clicking on the "Submit Changes" button, I'm presented with this error…
Trac detected an internal error:
int argument required
Traceback (most recent call last):
  File "/usr/local/python/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 103, in run
    dispatch_request(os.getenv('PATH_INFO', ''), req, env)
  File "/usr/local/python/lib/python2.4/site-packages/trac/web/main.py", line 419, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/python/lib/python2.4/site-packages/trac/web/main.py", line 283, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/python/lib/python2.4/site-packages/trac/Ticket.py", line 468, in process_request
    self._do_save(req, db, ticket)
  File "/usr/local/python/lib/python2.4/site-packages/trac/Ticket.py", line 609, in _do_save
    self.log.exception("Failure sending notification on change to "
TypeError: int argument required
I'm using revision: 1703
Attachments (0)
Change History (7)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
Confirm, I had the same thing after upgrading. However, the second time it worked and it seems to be fine now.
comment:3 by , 20 years ago
| Description: | modified (diff) | 
|---|---|
| Owner: | changed from to | 
| Status: | new → assigned | 
comment:6 by , 20 years ago
| Cc: | added | 
|---|
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 ticketid to be an int, but it's a string at that point. I think the culprit is line 221 of Notify.py: {{{ tktid = '%s' % tktid}}}, 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.
comment:7 by , 20 years ago
| Milestone: | → 0.9 | 
|---|---|
| Resolution: | → fixed | 
| Status: | assigned → closed | 
Should be fixed in [1831].



  
Confirm, I had the same thing after upgrading. However, the second time it worked and it seems to be fine now.