[Zope-Checkins] CVS: Packages/Shared/DC/ZRDB - sqltest.py:1.18.68.2

Andreas Jung andreas at andreas-jung.com
Mon Oct 11 07:36:53 EDT 2004


Update of /cvs-repository/Packages/Shared/DC/ZRDB
In directory cvs.zope.org:/tmp/cvs-serv7365/lib/python/Shared/DC/ZRDB

Modified Files:
      Tag: Zope-2_7-branch
	sqltest.py 
Log Message:
     - ZSQL methods: added  workaround for a problem where a 'string' argument
       variable was included into the generated query if the 'optional' flag inside
       dtml-sqltest was set an if the value of the string was empty.


=== Packages/Shared/DC/ZRDB/sqltest.py 1.18.68.1 => 1.18.68.2 ===
--- Packages/Shared/DC/ZRDB/sqltest.py:1.18.68.1	Mon Nov 17 17:34:16 2003
+++ Packages/Shared/DC/ZRDB/sqltest.py	Mon Oct 11 07:36:53 2004
@@ -115,7 +115,6 @@
         self.op = op
 
     def render(self, md):
-
         name=self.__name__
 
         t=self.type
@@ -159,6 +158,14 @@
                 except ValueError:
                     raise ValueError, (
                         'Invalid floating-point value for <em>%s</em>' % name)
+
+            ## ZSQL methods: added  workaround for a problem where a 'string' argument
+            ## variable was included into the generated query if the 'optional' flag inside
+            ## dtml-sqltest was set an if the value of the string was empty.
+
+            elif t=='string' and len(str(v)) == 0  and args.get('optional', 0):
+                continue
+
             else:
                 v=str(v)
                 v=md.getitem('sql_quote__',0)(v)
@@ -172,6 +179,7 @@
             else:
                 err = 'Invalid empty string value for <em>%s</em>' % name
                 raise ValueError, err
+
 
         if not vs:
             if self.optional: return ''



More information about the Zope-Checkins mailing list