Modify ↓
#13219 closed defect (fixed)
plugin crash when we update a ticket vie email2trac
| Reported by: | Owned by: | Russ Tyndall | |
|---|---|---|---|
| Priority: | high | Component: | TimingAndEstimationPlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: |
Description
the crash is:
Jun 21 18:25:46 xdocref1 email2trac helpdesk: File "/data/virtualenvs/trac/lib/python2.7/site-packages/trac/ticket/model.py", line 369, in save_changes#012 listener.ticket_changed(self, comment, author, old_values)
timingandestimationplugin/ticket_daemon.py", line 153, in ticket_changed#012 self.watch_hours(ticket, author)
timingandestimationplugin/ticket_daemon.py", line 107, in watch_hours#012 hours = convertfloat(ticket['hours'])
timingandestimationplugin/ticket_daemon.py", line 14, in convertfloat#012 return float(x.replace(',','.'))
ValueError: could not convert string to float: None
Because hours has value none. Here is the patch:
===================================================================
--- timingandestimationplugin/ticket_daemon.py (revision 16672)
+++ timingandestimationplugin/ticket_daemon.py (working copy)
@@ -9,7 +9,11 @@
def convertfloat(x):
"some european countries use , as the decimal separator"
- x = str(x).strip()
+ if x:
+ x = str(x).strip()
+ else:
+ x = ''
+
if len(x) > 0:
return float(x.replace(',','.'))
else:
Attachments (0)
Change History (5)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Not sure what version you are using, but my version had different code in it than yours. I applied a slightly different patch which should more directly handle getting false-ish values (None, False, 0, ) by having it directly return 0
Thanks for the bug report and patch. Sorry it took a while to process it
comment:4 Changed 8 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
I think this should be fixed now. Thanks for the bug report
Note: See
TracTickets for help on using
tickets.



Thanks for the patch, I will try to get it processed in soon. Your help is much appreciated.
Cheers, Russ Tyndall Acceleration.net