Modify

Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#13219 closed defect (fixed)

plugin crash when we update a ticket vie email2trac

Reported by: bas.vandervlies@… 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 16 months ago by Russ Tyndall

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

Cheers, Russ Tyndall Acceleration.net

comment:2 Changed 16 months ago by Russ Tyndall

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:3 Changed 16 months ago by Russ Tyndall

In 16685:

Handle false-ish values in ticket_daemon convert_float

re #13219

comment:4 Changed 16 months ago by Russ Tyndall

Resolution: fixed
Status: newclosed

I think this should be fixed now. Thanks for the bug report

comment:5 Changed 16 months ago by Russ Tyndall

In 16688:

Porting changes from the non permission branch

  • Remove defunct, unused macros include in billing.html re #12853
  • Update database access for proper trac 1.1 Thanks lkraav re #13080
  • be more forgiving about what goes through convert float in ticket daemon re #13219
  • Change billing html a bit re #11280

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.