Commit a1f7ee68 authored by Andreas Jung's avatar Andreas Jung

Collector #2409,2410: broken handling of quoted default argeuments in ZSQL...

Collector #2409,2410: broken handling of quoted default argeuments in ZSQL methods (wrong regular expression conversion)
parent bfb77406
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
__doc__='''Shared classes and functions __doc__='''Shared classes and functions
$Id: Aqueduct.py,v 1.49 2001/05/16 15:13:00 shane Exp $''' $Id: Aqueduct.py,v 1.50 2001/07/17 15:05:44 andreas Exp $'''
__version__='$Revision: 1.49 $'[11:-2] __version__='$Revision: 1.50 $'[11:-2]
import Globals, os import Globals, os
from Globals import Persistent from Globals import Persistent
...@@ -340,6 +340,7 @@ class Args: ...@@ -340,6 +340,7 @@ class Args:
def __delitem__(self, key): del self._data[key] def __delitem__(self, key): del self._data[key]
def __len__(self): return len(self._data) def __len__(self): return len(self._data)
def parse(text, def parse(text,
result=None, result=None,
keys=None, keys=None,
...@@ -351,35 +352,40 @@ def parse(text, ...@@ -351,35 +352,40 @@ def parse(text,
r'([\000- ]*([^\000- ="]+)="([^"]*)")'), r'([\000- ]*([^\000- ="]+)="([^"]*)")'),
): ):
if result is None: if result is None:
result = {} result = {}
keys=[] keys = []
__traceback_info__=text __traceback_info__=text
mo = parmre.match(text) mo = parmre.match(text)
if mo: if mo:
name=mo.group(2) name = mo.group(2)
value={'default':mo.group(3)} value = {'default':mo.group(3)}
l=len(mo.group(1)) l = len(mo.group(1))
else: else:
mo = qparmre.match(text) mo = qparmre.match(text)
if mo: if mo:
name=mo.group(1) name = mo.group(2)
value={'default':mo.group(3)} value = {'default':mo.group(3)}
l=len(mo.group(2)) l = len(mo.group(1))
else: else:
mo = unparmre.match(text) mo = unparmre.match(text)
if mo: if mo:
name=mo.group(2) name = mo.group(2)
l=len(mo.group(1)) value = {}
value={} l = len(mo.group(1))
else: else:
if not text or not strip(text): return Args(result,keys) if not text or not text.strip(): return Args(result,keys)
raise InvalidParameter, text raise InvalidParameter, text
lt=name.find(':')
lt=string.find(name,':')
if lt > 0: if lt > 0:
value['type']=name[lt+1:] value['type']=name[lt+1:]
name=name[:lt] name=name[:lt]
...@@ -389,6 +395,7 @@ def parse(text, ...@@ -389,6 +395,7 @@ def parse(text,
return parse(text[l:],result,keys) return parse(text[l:],result,keys)
def quotedHTML(text, def quotedHTML(text,
character_entities=( character_entities=(
('&', '&'), ('&', '&'),
......
...@@ -85,11 +85,11 @@ ...@@ -85,11 +85,11 @@
__doc__='''Class for reading RDB files __doc__='''Class for reading RDB files
$Id: RDB.py,v 1.30 2001/04/27 18:07:16 andreas Exp $''' $Id: RDB.py,v 1.31 2001/07/17 15:05:44 andreas Exp $'''
__version__='$Revision: 1.30 $'[11:-2] __version__='$Revision: 1.31 $'[11:-2]
from string import split, strip, lower, upper, atof, atoi, atol, find, join,find from string import split, strip, lower, upper, atof, atoi, atol, find, join,find
import DateTime import DateTime,re
from Missing import MV from Missing import MV
from array import array from array import array
from Record import Record from Record import Record
...@@ -180,12 +180,14 @@ class DatabaseResults: ...@@ -180,12 +180,14 @@ class DatabaseResults:
_def=strip(_def) _def=strip(_def)
if not _def: if not _def:
raise ValueError, ('Empty column definition for %s' % names[i]) raise ValueError, ('Empty column definition for %s' % names[i])
if defre.match(_def) is None:
mo = defre.match(_def)
if mo is None:
raise ValueError, ( raise ValueError, (
'Invalid column definition for, %s, for %s' 'Invalid column definition for, %s, for %s'
% _def, names[i]) % _def, names[i])
type=lower(defre.group(2)) type = mo.group(2).lower()
width=defre.group(1) width = mo.group(1)
if width: width=atoi(width) if width: width=atoi(width)
else: width=8 else: width=8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment