commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r9070 - trunk/gnue-forms/src/GFObjects


From: reinhard
Subject: [gnue] r9070 - trunk/gnue-forms/src/GFObjects
Date: Mon, 27 Nov 2006 06:49:52 -0600 (CST)

Author: reinhard
Date: 2006-11-27 06:49:52 -0600 (Mon, 27 Nov 2006)
New Revision: 9070

Modified:
   trunk/gnue-forms/src/GFObjects/GFField.py
Log:
Allow length/maxLength attribute only for text fields that are no lookups.

issue10 testing


Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py   2006-11-27 12:09:37 UTC (rev 
9069)
+++ trunk/gnue-forms/src/GFObjects/GFField.py   2006-11-27 12:49:52 UTC (rev 
9070)
@@ -41,6 +41,14 @@
 
 # =============================================================================
 
+class LengthNotAllowedError(GParser.MarkupError):
+    def __init__(self, field):
+        msg = u_("Field '%(name)s' may not have a 'length' attribute") \
+              % {'name': field.name}
+        GParser.MarkupError.__init__ (self, msg, field._url, field._lineNumber)
+
+# =============================================================================
+
 class DataSourceNotFoundError (GParser.MarkupError):
     def __init__ (self, name, field):
         msg = u_("Datasource '%(name)s' not found") % {'name': name}
@@ -205,6 +213,11 @@
           self.__is_lookup = True
 
 
+        # Check if "length" attribute is allowed
+        if hasattr(self, 'length') \
+                and (self.datatype != 'text' or self.__is_lookup):
+            raise LengthNotAllowedError(self)
+
         if hasattr(self, 'queryDefault') and self.queryDefault != None and \
              self._bound and len(self.queryDefault):
           block._queryDefaults[self] = self.queryDefault





reply via email to

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