[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9002 - in trunk/gnue-forms/src: . GFObjects input/displayHandler
From: |
reinhard |
Subject: |
[gnue] r9002 - in trunk/gnue-forms/src: . GFObjects input/displayHandlers |
Date: |
Wed, 8 Nov 2006 10:59:47 -0600 (CST) |
Author: reinhard
Date: 2006-11-08 10:59:46 -0600 (Wed, 08 Nov 2006)
New Revision: 9002
Modified:
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
trunk/gnue-forms/src/GFParser.py
trunk/gnue-forms/src/input/displayHandlers/Dropdown.py
Log:
Added new attribute startup="empty|full" to block to allow to replace prequery
on datasource level.
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2006-11-08 13:49:06 UTC (rev 9001)
+++ trunk/gnue-forms/src/GFForm.py 2006-11-08 16:59:46 UTC (rev 9002)
@@ -283,10 +283,9 @@
# build the UI form
self._instance._uiinstance.buildForm(self, self.name)
- # create the first records
- for key in self._datasourceDictionary.keys():
- if not self._datasourceDictionary[key].hasMaster():
- self._datasourceDictionary[key].createEmptyResultSet()
+ # populate the blocks
+ for block in self._logic._blockList:
+ block.populate()
self.update_insert_status()
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-11-08 13:49:06 UTC (rev
9001)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-11-08 16:59:46 UTC (rev
9002)
@@ -910,6 +910,25 @@
# Queries
# -------------------------------------------------------------------------
+ def populate(self):
+ """
+ Populate the block with data at startup.
+
+ Depending on the properties of the block, it is populated either with a
+ single empty record or the result of a full query.
+ """
+
+ if self._getMasterBlock() is not None:
+ # Population will happen through the master
+ return
+
+ if self.startup == 'full':
+ self.query()
+ elif self.startup == 'empty':
+ self.clear()
+
+ # -------------------------------------------------------------------------
+
def init_query(self):
self.mode = 'query'
Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py 2006-11-08 13:49:06 UTC (rev 9001)
+++ trunk/gnue-forms/src/GFParser.py 2006-11-08 16:59:46 UTC (rev 9002)
@@ -357,6 +357,18 @@
'between duplicated widgets. Serves the same '
'purpose as some of the gap attributes on '
'individual widgets.' },
+ 'startup': {
+ 'Label': u_("Startup state"),
+ 'Description': u_(
+ "State in which the block will be on form startup. "
+ "'Empty' means the block is filled with a single empty "
+ "record, 'full' means the block is populated with the "
+ "result of a full query."),
+ 'Typecast': GTypecast.name,
+ 'ValueSet': {
+ 'empty': {'Label': u_('Empty')},
+ 'full': {'Label': u_('Full')}},
+ 'Default': 'empty'},
'transparent':{
'Typecast': GTypecast.boolean,
'Label': _('Transparent Nav'),
Modified: trunk/gnue-forms/src/input/displayHandlers/Dropdown.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Dropdown.py 2006-11-08
13:49:06 UTC (rev 9001)
+++ trunk/gnue-forms/src/input/displayHandlers/Dropdown.py 2006-11-08
16:59:46 UTC (rev 9002)
@@ -92,7 +92,8 @@
return display
return value
- if self.field._allowedValues.has_key ("%s" % value):
+ if self.field._allowedValues is not None \
+ and self.field._allowedValues.has_key ("%s" % value):
return self.field._allowedValues ["%s" % value]
else:
return ""
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9002 - in trunk/gnue-forms/src: . GFObjects input/displayHandlers,
reinhard <=