[Zope-dev] Z SQL Method problems (now two confirmed bugs)

Andy Dustman andy@dustman.net
Thu, 9 Aug 2001 16:56:22 -0400 (EDT)


On Thu, 9 Aug 2001, Chris McDonough wrote:

> Thanks very much for tracking this down!  Do you think you can put it in
> the Collector?

It is covered by bugs 2410 and 2495. The patch is relatively small so here
it comes:

--- Zope-2.4.0/lib/python/Shared/DC/ZRDB/Aqueduct.py.orig	Thu Aug  9 15:55:39 2001
+++ Zope-2.4.0/lib/python/Shared/DC/ZRDB/Aqueduct.py	Thu Aug  9 15:57:26 2001
@@ -341,22 +341,24 @@
     def __len__(self): return len(self._data)


+unparmre=re.compile(
+    r'([\000- ]*([^\000- ="]+))')
+parmre=re.compile(
+    r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))')
+qparmre=re.compile(
+    r'([\000- ]*([^\000- ="]+)="([^"]*)")')
+
 def parse(text,
           result=None,
           keys=None,
-          unparmre=re.compile(
-              r'([\000- ]*([^\000- ="]+))'),
-          parmre=re.compile(
-              r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'),
-          qparmre=re.compile(
-              r'([\000- ]*([^\000- ="]+)="([^"]*)")'),
           ):

-
     if result is None:
         result  = {}
         keys    = []

+    if not text or not text.strip(): return Args(result,keys)
+
     __traceback_info__=text

     mo  = parmre.match(text)
@@ -382,13 +384,16 @@
                 value   = {}
                 l       = len(mo.group(1))
             else:
-                if not text or not text.strip(): return Args(result,keys)
                 raise InvalidParameter, text

     lt=name.find(':')
     if lt > 0:
-        value['type']=name[lt+1:]
+        t=value['type']=name[lt+1:]
         name=name[:lt]
+        lt=t.find(':')
+        if lt > 0:
+            value['type']=t[:lt]
+            value[t[lt+1:]]=1

     result[name]=value
     keys.append(name)

-- 
Andy Dustman         PGP: 0xC72F3F1D
    @       .net     http://dustman.net/andy
I'll give spammers one bite of the apple, but they'll
have to guess which bite has the razor blade in it.