[CMF-checkins] CVS: CMF/CMFDefault - utils.py:1.11
Tres Seaver
tseaver@zope.com
Wed, 13 Mar 2002 07:27:03 -0500
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv2242/CMFDefault
Modified Files:
utils.py
Log Message:
- Applied Lucas Hofman's patch (Tracker #479) to strip leading / trailing
whitespace from tuplized keywords.
=== CMF/CMFDefault/utils.py 1.10 => 1.11 ===
return map(strip, split(s, ','))
+def seq_strip (seq, stripper=strip):
+ if type(seq) == type([]):
+ return map ( stripper, seq)
+ if type(seq) == type(()):
+ #seq1 = list(seq)
+ return tuple (map(stripper, seq))
+ raise ValueError, "%s of unsupported sequencetype %s" % (seq, type(seq))
+
def tuplize( valueName, value, splitter=split ):
- if type(value) == type(()): return value
- if type(value) == type([]): return tuple( value )
- if type(value) == type(''): return tuple( splitter( value ) )
+ if type(value) == type(()): return seq_strip( value )
+ if type(value) == type([]): return seq_strip( tuple( value ))
+ if type(value) == type(''): return seq_strip( tuple( splitter( value ) ))
raise ValueError, "%s of unsupported type" % valueName