[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9105 - trunk/gnue-forms/src/GFObjects
From: |
reinhard |
Subject: |
[gnue] r9105 - trunk/gnue-forms/src/GFObjects |
Date: |
Mon, 4 Dec 2006 10:22:39 -0600 (CST) |
Author: reinhard
Date: 2006-12-04 10:22:38 -0600 (Mon, 04 Dec 2006)
New Revision: 9105
Modified:
trunk/gnue-forms/src/GFObjects/GFField.py
Log:
Added minLength check, fixed length check.
Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py 2006-12-04 16:17:37 UTC (rev
9104)
+++ trunk/gnue-forms/src/GFObjects/GFField.py 2006-12-04 16:22:38 UTC (rev
9105)
@@ -199,11 +199,17 @@
self.__is_lookup = True
- # Check if "length" attribute is allowed
+ # Check if "length" attribute is allowed.
if self.length is not None \
- and (self.datatype != 'text' or self.__is_lookup):
+ and (self.datatype not in ['text', 'number'] \
+ or self.__is_lookup):
raise LengthNotAllowedError(self)
+ # Check if "minLength" attribute is allowed.
+ if self.minLength > 0 \
+ and (self.datatype != 'text' or self.__is_lookup):
+ raise MinimumLengthNotAllowedError(self)
+
if hasattr(self, 'queryDefault') and self.queryDefault != None and \
self._bound and len(self.queryDefault):
block._queryDefaults[self] = self.queryDefault
@@ -604,6 +610,16 @@
# =============================================================================
+class MinimumLengthNotAllowedError(GParser.MarkupError):
+ def __init__(self, field):
+ GParser.MarkupError.__init__(self, u_(
+ "Field '%(name)s' may not have a 'minLength' attribute"
+ ) % {
+ 'name': field.name},
+ field._url, field._lineNumber)
+
+# =============================================================================
+
class DataSourceNotFoundError(GParser.MarkupError):
def __init__(self, name, field):
GParser.MarkupError.__init__(self, u_(
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9105 - trunk/gnue-forms/src/GFObjects,
reinhard <=