--- Converters.py.orig Wed May 12 14:52:59 1999 +++ Converters.py Wed May 12 15:30:09 1999 @@ -86,6 +86,7 @@ import regex from string import atoi, atol, atof, join, split, strip +from types import ListType, TupleType def field2string(v): if hasattr(v,'read'): v=v.read() @@ -114,6 +115,8 @@ raise ValueError, 'No input for required field

' def field2int(v): + if type(v) in (ListType, TupleType): + return map(field2int, v) if hasattr(v,'read'): v=v.read() else: v=str(v) # we can remove the check for an empty string when we go to python 1.4 @@ -121,6 +124,8 @@ raise ValueError, 'Empty entry when integer expected' def field2float(v): + if type(v) in (ListType, TupleType): + return map(field2float, v) if hasattr(v,'read'): v=v.read() else: v=str(v) # we can remove the check for an empty string when we go to python 1.4 @@ -129,6 +134,8 @@ 'Empty entry when floating-point number expected') def field2long(v): + if type(v) in (ListType, TupleType): + return map(field2long, v) if hasattr(v,'read'): v=v.read() else: v=str(v) # we can remove the check for an empty string when we go to python 1.4 @@ -149,23 +156,15 @@ else: v=str(v) return DateTime(v) -def field2date(v): - from DateTime import DateTime - if hasattr(v,'read'): v=v.read() - else: v=str(v) - return DateTime(v) - def field2boolean(v): return v -ListType=type([]) - def field2list(v): if type(v) is not ListType: v=[v] return v def field2tuple(v): - if type(v) is not ListType: v=(v,) + if type(v) is not TupleType: v=(v,) return tuple(v) type_converters = {