[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8680 - trunk/gnue-forms/src/GFObjects
From: |
reinhard |
Subject: |
[gnue] r8680 - trunk/gnue-forms/src/GFObjects |
Date: |
Wed, 13 Sep 2006 11:06:15 -0500 (CDT) |
Author: reinhard
Date: 2006-09-13 11:06:14 -0500 (Wed, 13 Sep 2006)
New Revision: 8680
Modified:
trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Changed the name of some private variables.
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-09-13 15:49:04 UTC (rev
8679)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-09-13 16:06:14 UTC (rev
8680)
@@ -74,9 +74,10 @@
self._currentRecord = 0
self._recordCount = 0
self._queryDefaults = {}
- self._queryValues = {}
- self._lastQueryValues = {}
+ self.__query_values = {}
+ self.__last_query_values = {}
+
#: A list of all GFScrollbar objects bound to this block
self.__scrollbars = []
@@ -423,7 +424,7 @@
"""
if self.mode == 'query':
- value = self._queryValues.get(field)
+ value = self.__query_values.get(field)
elif self.mode == 'init':
value = self._initializingRecord[field.field]
@@ -447,9 +448,9 @@
if self.mode == 'query':
if value is None:
- del self._block._queryValues[field]
+ del self._block.__query_values[field]
else:
- self._queryValues[field] = value
+ self.__query_values[field] = value
elif self.mode == 'init':
self._initializingRecord[field.field] = value
@@ -881,16 +882,16 @@
def init_query(self):
self.mode = 'query'
- self._queryValues = {}
- self._queryValues.update(self._queryDefaults)
+ self.__query_values = {}
+ self.__query_values.update(self._queryDefaults)
self.__switch_record(0)
# ---------------------------------------------------------------------------
def copy_query(self):
- self._queryValues = {}
- self._queryValues.update(self._lastQueryValues)
+ self.__query_values = {}
+ self.__query_values.update(self.__last_query_values)
self.__switch_record(0)
# ---------------------------------------------------------------------------
@@ -910,7 +911,7 @@
# Find the longest master/detail chain that contains query values. This
# will become the chain that is queried.
for block in self._logic._blockList:
- if block._queryValues.keys ():
+ if block.__query_values.keys ():
templist = [block]
while (templist [-1])._getMasterBlock ():
@@ -922,22 +923,22 @@
# Store block states
for block in self._logic._blockList:
block.mode = 'normal'
- block._lastQueryValues = {}
- block._lastQueryValues.update (block._queryValues)
+ block.__last_query_values = {}
+ block.__last_query_values.update (block.__query_values)
# graft in the sloppy query stuff if needed
for block in maxList:
for entry in block._entryList:
if hasattr (entry._field, 'sloppyQuery') and \
- block._queryValues.has_key (entry._field):
- block._queryValues [entry._field] = "%" + \
- "%".join (list (block._queryValues [entry._field])) + "%"
+ block.__query_values.has_key (entry._field):
+ block.__query_values [entry._field] = "%" + \
+ "%".join (list (block.__query_values [entry._field])) + "%"
# Find root block
rootBlock = maxList [-1]
# Condition for the master block
- conditions = _generateConditional (rootBlock)
+ conditions = rootBlock._generateConditional ()
# Conditions for the detail block
for block in maxList [:-1]:
@@ -946,7 +947,7 @@
for field in block._fieldList:
field.processTrigger ('PRE-QUERY')
- c = _generateConditional (block)
+ c = block._generateConditional ()
exist = GConditions.GCexist ()
exist.table = block._dataSourceLink.table
exist.masterlink = block._dataSourceLink.masterlink
@@ -1327,119 +1328,118 @@
return self.autoNextRecord
-# -----------------------------------------------------------------------------
-# Create a condition tree for a given block
-# -----------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
+ # Create a condition tree
+ # ---------------------------------------------------------------------------
-def _generateConditional (block):
- """
- Create a condition tree based upon the values currently stored in the form.
+ def _generateConditional (self):
+ """
+ Create a condition tree based upon the values currently stored in the form.
- @param block: GFBlock instance to create a condition for
- @return: GCondition instance with the condition to use or an empty dictionary
- if no condition is needed.
- """
+ @return: GCondition instance with the condition to use or an empty
+ dictionary if no condition is needed.
+ """
- # 'user input': [GCondition, pass value?]
- baseComparisons = { '>': ['gt', True],
- '>=': ['ge', True],
- '<': ['lt', True],
- '<=': ['le', True],
- '=': ['eq', True],
- '!=': ['ne', True],
- 'like': ['like', True],
- 'empty': ['null', False],
- 'notempty': ['notnull', False],
- }
- comparisonDelimeter = ":"
+ # 'user input': [GCondition, pass value?]
+ baseComparisons = { '>': ['gt', True],
+ '>=': ['ge', True],
+ '<': ['lt', True],
+ '<=': ['le', True],
+ '=': ['eq', True],
+ '!=': ['ne', True],
+ 'like': ['like', True],
+ 'empty': ['null', False],
+ 'notempty': ['notnull', False],
+ }
+ comparisonDelimeter = ":"
- condLike = {}
- condEq = {}
- conditions = []
- # Get all the user-supplied parameters from the entry widgets
- for entry, val in block._queryValues.items ():
- if entry._bound and entry.isQueryable () and len (("%s" % val)):
+ condLike = {}
+ condEq = {}
+ conditions = []
+ # Get all the user-supplied parameters from the entry widgets
+ for entry, val in self.__query_values.items ():
+ if entry._bound and entry.isQueryable () and len (("%s" % val)):
- # New : operator support
- match = False
- for comparison in baseComparisons.keys():
+ # New : operator support
+ match = False
+ for comparison in baseComparisons.keys():
- if isinstance(val, basestring) and \
- val[:2+len(comparison)].lower() == "%s%s%s" % \
- (comparisonDelimeter, comparison, comparisonDelimeter):
- value=val[2+len(comparison):]
+ if isinstance(val, basestring) and \
+ val[:2+len(comparison)].lower() == "%s%s%s" % \
+ (comparisonDelimeter, comparison, comparisonDelimeter):
+ value=val[2+len(comparison):]
- if baseComparisons[comparison][1]:
- field = ['field', entry.field]
- const = ['const', value]
+ if baseComparisons[comparison][1]:
+ field = ['field', entry.field]
+ const = ['const', value]
- if not entry.query_casesensitive:
- field = ['upper', field]
- const = ['upper', const]
+ if not entry.query_casesensitive:
+ field = ['upper', field]
+ const = ['upper', const]
- conditions.append([baseComparisons[comparison][0], field, const])
- else:
- conditions.append([ baseComparisons[comparison][0],
- ['field', entry.field]
- ])
- match = True
- break
+ conditions.append([baseComparisons[comparison][0], field,
const])
+ else:
+ conditions.append([ baseComparisons[comparison][0],
+ ['field', entry.field]
+ ])
+ match = True
+ break
- if not match and isinstance(val, bool) and not val:
- conditions.append(['or', \
- ['eq', ['field', entry.field], ['const', val]],
- ['null', ['field', entry.field]]])
- match = True
+ if not match and isinstance(val, bool) and not val:
+ conditions.append(['or', \
+ ['eq', ['field', entry.field], ['const', val]],
+ ['null', ['field', entry.field]]])
+ match = True
- # Falls through to old behaviour if no : condition given or
- # the : condition is unknown
- if not match:
- if entry.typecast == 'text':
- if block._convertAsterisksToPercent:
- try:
- val = ("%s" % val).replace ('*', '%')
- except ValueError:
- pass
+ # Falls through to old behaviour if no : condition given or
+ # the : condition is unknown
+ if not match:
+ if entry.typecast == 'text':
+ if self._convertAsterisksToPercent:
+ try:
+ val = ("%s" % val).replace ('*', '%')
+ except ValueError:
+ pass
- val = cond_value(val)
+ val = cond_value(val)
- if (val.find ('%') >= 0 or val.find ('_') >= 0):
- condLike [entry] = val
+ if (val.find ('%') >= 0 or val.find ('_') >= 0):
+ condLike [entry] = val
+ else:
+ condEq [entry] = val
else:
condEq [entry] = val
- else:
- condEq [entry] = val
- epf = []
- for (entry, value) in condEq.items():
- field = ['field', entry.field]
- const = ['const', value]
+ epf = []
+ for (entry, value) in condEq.items():
+ field = ['field', entry.field]
+ const = ['const', value]
- if not entry.query_casesensitive:
- field = ['upper', field]
- const = ['upper', const]
+ if not entry.query_casesensitive:
+ field = ['upper', field]
+ const = ['upper', const]
- epf.append(['eq', field, const])
+ epf.append(['eq', field, const])
- lpf = []
- for (entry, value) in condLike.items():
- field = ['field', entry.field]
- const = ['const', value]
+ lpf = []
+ for (entry, value) in condLike.items():
+ field = ['field', entry.field]
+ const = ['const', value]
- if not entry.query_casesensitive:
- field = ['upper', field]
- const = ['upper', const]
+ if not entry.query_casesensitive:
+ field = ['upper', field]
+ const = ['upper', const]
- epf.append(['like', field, const])
+ epf.append(['like', field, const])
- if epf or lpf or conditions:
- result = GConditions.buildConditionFromPrefix (['and'] + epf +
- lpf + conditions)
- else:
- result = {}
+ if epf or lpf or conditions:
+ result = GConditions.buildConditionFromPrefix (['and'] + epf +
+ lpf + conditions)
+ else:
+ result = {}
- return result
+ return result
# -----------------------------------------------------------------------------
# Change a condition value as needed
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8680 - trunk/gnue-forms/src/GFObjects,
reinhard <=