dabo Commit
Revision 4697
Date: 2008-11-20 14:43:01 -0800 (Thu, 20 Nov 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4697

Changed:
U   trunk/dabo/ui/uiwx/dTextBoxMixin.py

Log:
Found another place that needed the try block for invalid decimals, and I
decided that stripping the string value first was the nice thing to do.


Diff:
Modified: trunk/dabo/ui/uiwx/dTextBoxMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBoxMixin.py 2008-11-20 22:29:25 UTC (rev 4696)
+++ trunk/dabo/ui/uiwx/dTextBoxMixin.py 2008-11-20 22:43:01 UTC (rev 4697)
@@ -455,6 +455,7 @@
 
                        # Preprocess trying to do a decimal conversion, to 
filter out
                        # invalid input before doing a number of things below:
+                       strVal = strVal.strip()
                        try:
                                decimal.Decimal(strVal)
                        except decimal.InvalidOperation:
@@ -479,7 +480,10 @@
                                        else:
                                                retVal = int(strVal)
                                else:
-                                       retVal = decimal.Decimal(strVal)
+                                       try:
+                                               retVal = 
decimal.Decimal(strVal.strip())
+                                       except decimal.InvalidOperation:
+                                               raise ValueError, _("Invalid 
decimal value.")
                        except valueErrors:
                                raise ValueError, _("Invalid Numeric Value: 
%s") % strVal
                else:




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to