dabo Commit
Revision 1201
Date: 2005-08-27 08:59:12 -0700 (Sat, 27 Aug 2005)
Author: ed
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Forgot to save the last set of changes before committing...
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2005-08-27 15:31:38 UTC (rev 1200)
+++ trunk/dabo/biz/dBizobj.py 2005-08-27 15:59:12 UTC (rev 1201)
@@ -516,16 +516,24 @@
"""Replaces all 'fld' values in the recordset with the specified
value, as long as the record meets the specified condition.
"""
- flds = self.getFieldNames()
- pat = "(\w+)"
- condSplit = re.split(pat, cond)
- wordCnt = len(condSplit)
- for ii in range(wordCnt):
- if condSplit[ii] in flds:
- # This is a field name; change it to a self
reference
- condSplit[ii] = "self.%s" % condSplit[ii]
- # Join it back up
- cond = "".join(condSplit)
+ if cond:
+ # A condition was passed. Massage the string, replacing
+ # raw field names with self.fieldname so that eval()
can be
+ # used to determine if it's True.
+ flds = self.getFieldNames()
+ pat = "(\w+)"
+ condSplit = re.split(pat, cond)
+ wordCnt = len(condSplit)
+ for ii in range(wordCnt):
+ if condSplit[ii] in flds:
+ # This is a field name; change it to a
self reference
+ condSplit[ii] = "self.%s" %
condSplit[ii]
+ # Join it back up
+ cond = "".join(condSplit)
+ else:
+ # No condition was passed. This means that they want
+ # to replace *all* records.
+ cond = "True"
self.scan(self.__condReplace, cond, fld, val)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev