[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9100 - trunk/gnue-forms/src/GFObjects
From: |
reinhard |
Subject: |
[gnue] r9100 - trunk/gnue-forms/src/GFObjects |
Date: |
Mon, 4 Dec 2006 08:05:50 -0600 (CST) |
Author: reinhard
Date: 2006-12-04 08:05:49 -0600 (Mon, 04 Dec 2006)
New Revision: 9100
Modified:
trunk/gnue-forms/src/GFObjects/GFBlock.py
trunk/gnue-forms/src/GFObjects/GFField.py
Log:
Code cleanup, docstrings.
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-12-04 13:22:28 UTC (rev
9099)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-12-04 14:05:49 UTC (rev
9100)
@@ -25,8 +25,6 @@
Classes making up the Block object.
"""
-__all__ = ['GFBlock', 'DatasourceNotFoundError']
-
from gnue.common.datasources import GConditions
from gnue.common.definitions import GParser
from gnue.common import events
@@ -34,7 +32,9 @@
from gnue.forms.GFObjects.GFContainer import GFContainer
from gnue.forms.GFObjects.GFDataSource import GFDataSource
+__all__ = ['GFBlock', 'DatasourceNotFoundError']
+
# =============================================================================
# <block>
# =============================================================================
Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py 2006-12-04 13:22:28 UTC (rev
9099)
+++ trunk/gnue-forms/src/GFObjects/GFField.py 2006-12-04 14:05:49 UTC (rev
9100)
@@ -20,53 +20,24 @@
# - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id$
+
"""
-Implementation of block fields
+Fields of a block, representing database columns.
"""
from gnue.common.apps import errors
from gnue.common.definitions import GParser
+
from gnue.forms.GFObjects import GFObj
+__all__ = ['GFField', 'FKeyMissingError', 'LengthNotAllowedError',
+ 'DataSourceNotFoundError', 'InvalidFieldValueError']
-# =============================================================================
-# Exceptions
-# =============================================================================
-class FKeyMissingError (GParser.MarkupError):
- def __init__ (self, field):
- msg = u_("Field '%(name)s' has a fk_source specified, but no fk_key") \
- % {'name': field.name}
- GParser.MarkupError.__init__ (self, msg, field._url, field._lineNumber)
-
# =============================================================================
-
-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)
-
+# <field>
# =============================================================================
-class DataSourceNotFoundError (GParser.MarkupError):
- def __init__ (self, name, field):
- msg = u_("Datasource '%(name)s' not found") % {'name': name}
- GParser.MarkupError.__init__ (self, msg, field._url, field._lineNumber)
-
-# =============================================================================
-
-class InvalidFieldValueError (errors.UserError):
- def __init__ (self, field, value):
- msg = u_("Invalid value '%(value)s' for field '%(field)s") \
- % {'value': value, 'field': field}
- errors.UserError.__init__ (self, msg)
-
-
-# =============================================================================
-# A field of a block
-# =============================================================================
-
class GFField(GFObj.GFObj):
"""
A field manages a database column, possibly with foreign key lookup.
@@ -85,24 +56,29 @@
GFObj.GFObj.__init__(self, parent, 'GFField')
+ # These 3 attributes are used by displayHandler to decide which kinds
+ # of keypresses to accept.
self._uppercase = False
self._lowercase = False
self._numeric = False
- self.__is_lookup = False
+ # These are also used by displayHandler.
self._allowedValues = None
self._allowedValuesDescr = [""]
self._allowedValuesReverse = {"":""}
+ # These are only here because "rows" and "gap" is passed from GFBlock
+ # through GFField to GFEntry.
self._rows = 1
self._gap = 0
- # This will be populated by GFEntry's initialize
+ # This will be populated by GFEntry's initialize.
self._entryList = []
- #
- # Trigger exposure
- #
+ # This is True if it is a lookup field.
+ self.__is_lookup = False
+
+ # Valid triggers
self._validTriggers = {
'PRE-FOCUSOUT': 'Pre-FocusOut',
'POST-FOCUSOUT': 'Post-FocusOut',
@@ -119,6 +95,7 @@
'POST-CHANGE': 'Post-Change',
}
+ # Trigger functions
self._triggerFunctions = {
'allowedValues' : {'function': self.allowedValues},
'autofillBySequence': {'function': self.triggerAutofillBySequence},
@@ -131,6 +108,10 @@
'setFKDescription' : {'function': self.setFKDescription},
}
+ self._triggerProperties = {
+ 'value': {'set': self.triggerSetValue,
+ 'get': self.getValue}}
+
self._triggerSet = self.triggerSetValue
self._triggerGet = self.getValue
@@ -598,3 +579,37 @@
value = float (value or 0)
self.setValue (value)
+
+
+# =============================================================================
+# Exceptions
+# =============================================================================
+
+class FKeyMissingError (GParser.MarkupError):
+ def __init__ (self, field):
+ msg = u_("Field '%(name)s' has a fk_source specified, but no fk_key") \
+ % {'name': field.name}
+ GParser.MarkupError.__init__ (self, msg, field._url, field._lineNumber)
+
+# =============================================================================
+
+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}
+ GParser.MarkupError.__init__ (self, msg, field._url, field._lineNumber)
+
+# =============================================================================
+
+class InvalidFieldValueError (errors.UserError):
+ def __init__ (self, field, value):
+ msg = u_("Invalid value '%(value)s' for field '%(field)s") \
+ % {'value': value, 'field': field}
+ errors.UserError.__init__ (self, msg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9100 - trunk/gnue-forms/src/GFObjects,
reinhard <=