commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8319 - in trunk/gnue-common/src: definitions formatting utils


From: reinhard
Subject: [gnue] r8319 - in trunk/gnue-common/src: definitions formatting utils
Date: Mon, 3 Apr 2006 18:24:02 -0500 (CDT)

Author: reinhard
Date: 2006-03-31 11:57:49 -0600 (Fri, 31 Mar 2006)
New Revision: 8319

Modified:
   trunk/gnue-common/src/definitions/GParser.py
   trunk/gnue-common/src/formatting/FormatExceptions.py
   trunk/gnue-common/src/formatting/GTypecast.py
   trunk/gnue-common/src/formatting/NumberMask.py
   trunk/gnue-common/src/formatting/TextMask.py
   trunk/gnue-common/src/utils/GDateTime.py
Log:
Fixed unicode handling in some exceptions.


Modified: trunk/gnue-common/src/definitions/GParser.py
===================================================================
--- trunk/gnue-common/src/definitions/GParser.py        2006-03-31 17:29:03 UTC 
(rev 8318)
+++ trunk/gnue-common/src/definitions/GParser.py        2006-03-31 17:57:49 UTC 
(rev 8319)
@@ -304,7 +304,7 @@
     #for element in self._singleInstanceTags:
     #  if self._tagCounts[element] > 1:
     #    raise MarkupError, \
-    #      _("File has multiple instances of <%s> when only one allowed") \
+    #      u_("File has multiple instances of <%s> when only one allowed") \
     #      % (element)
 
     for element in self._requiredTags:
@@ -395,7 +395,7 @@
 
         if attrns:
           if not self.xmlNamespaceAttributesAsPrefixes:
-            tmsg = _("Unexpected namespace on attribute")
+            tmsg = u_("Unexpected namespace on attribute")
             raise MarkupError, (tmsg, self.url, self.parser.getLineNumber ())
           prefix = attrns.split (':') [-1]
           lattrs [prefix + '__' + attr] = attrs [qattr]

Modified: trunk/gnue-common/src/formatting/FormatExceptions.py
===================================================================
--- trunk/gnue-common/src/formatting/FormatExceptions.py        2006-03-31 
17:29:03 UTC (rev 8318)
+++ trunk/gnue-common/src/formatting/FormatExceptions.py        2006-03-31 
17:57:49 UTC (rev 8319)
@@ -26,8 +26,10 @@
 # NOTES:
 #
 
+from gnue.common.apps import errors
+
 # Base Exception for markup problems with mask
-class MaskMarkupError (StandardError): 
+class MaskMarkupError (errors.ApplicationError): 
   pass
 
 # Developer specified a predefined mask (using "&name" notation)
@@ -41,7 +43,7 @@
 
 
 # Base exception for user/data input problems
-class MaskInputError (StandardError): 
+class MaskInputError (errors.UserError): 
   pass
 
 # The supplied input from user is invalid

Modified: trunk/gnue-common/src/formatting/GTypecast.py
===================================================================
--- trunk/gnue-common/src/formatting/GTypecast.py       2006-03-31 17:29:03 UTC 
(rev 8318)
+++ trunk/gnue-common/src/formatting/GTypecast.py       2006-03-31 17:57:49 UTC 
(rev 8319)
@@ -33,8 +33,10 @@
 import string
 from types import UnicodeType
 
+from gnue.common import errors
+
 # Raised if a value cannot be typecasted
-class TypecastError (ValueError): 
+class TypecastError (errors.UserError): 
   pass
 
 
@@ -161,8 +163,7 @@
   try:
     v = int("%s" % value)
     if v < 0: 
-      tmsg = _("Whole numbers must be positive or 0")
-      raise TypecastError, tmsg
+      raise TypecastError, u_("Whole numbers must be positive or 0")
     return v
   except ValueError:
     raise TypecastError

Modified: trunk/gnue-common/src/formatting/NumberMask.py
===================================================================
--- trunk/gnue-common/src/formatting/NumberMask.py      2006-03-31 17:29:03 UTC 
(rev 8318)
+++ trunk/gnue-common/src/formatting/NumberMask.py      2006-03-31 17:57:49 UTC 
(rev 8319)
@@ -200,8 +200,7 @@
             value[ self.inputMaskPos[i]: \
                    self.inputMaskPos[i] + self.inputMaskLen[i]], date )
       elif mustValidate: 
-        tmsg = _("Invalid Entry") 
-        raise InvalidEntry, tmsg
+        raise InvalidEntry, u_("Invalid Entry") 
 
     return date
     

Modified: trunk/gnue-common/src/formatting/TextMask.py
===================================================================
--- trunk/gnue-common/src/formatting/TextMask.py        2006-03-31 17:29:03 UTC 
(rev 8318)
+++ trunk/gnue-common/src/formatting/TextMask.py        2006-03-31 17:57:49 UTC 
(rev 8319)
@@ -189,8 +189,7 @@
             value[ self.inputMaskPos[i]: \
                    self.inputMaskPos[i] + self.inputMaskLen[i]], date )
       elif mustValidate: 
-        tmsg = _("Invalid Entry")  
-        raise InvalidEntry, tmsg
+        raise InvalidEntry, u_("Invalid Entry")  
 
     return date
     

Modified: trunk/gnue-common/src/utils/GDateTime.py
===================================================================
--- trunk/gnue-common/src/utils/GDateTime.py    2006-03-31 17:29:03 UTC (rev 
8318)
+++ trunk/gnue-common/src/utils/GDateTime.py    2006-03-31 17:57:49 UTC (rev 
8319)
@@ -353,7 +353,7 @@
 def isLeapYear (year):
   return calendar.isleap (year)
 
-class InvalidDate (StandardError):
+class InvalidDate (errors.UserError):
   pass
 
 class GDateTime:
@@ -389,8 +389,7 @@
         self.hour >= 0 and self.hour <= 23 and \
         self.minute >= 0 and self.minute <= 59 and \
         self.second >= 0 and self.second <= 59 ):
-      tmsg =  _("Not a valid date")
-      raise InvalidDate, tmsg
+      raise InvalidDate, u_("Not a valid date")
 
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]