Log message for revision 71941: Collector #2263: 'field2ulines' did not convert empty string correctly. o Forward-port from 2.8 branch.
Changed: U Zope/branches/2.10/lib/python/ZPublisher/Converters.py -=- Modified: Zope/branches/2.10/lib/python/ZPublisher/Converters.py =================================================================== --- Zope/branches/2.10/lib/python/ZPublisher/Converters.py 2007-01-11 21:33:49 UTC (rev 71940) +++ Zope/branches/2.10/lib/python/ZPublisher/Converters.py 2007-01-11 21:38:26 UTC (rev 71941) @@ -154,9 +154,18 @@ return unicode(field2text(v.encode('utf8')),'utf8') field2utext = field2utext() -class field2ulines(_unicode_converter): - def convert_unicode(self,v): - return field2utext.convert_unicode(v).split('\n') +class field2ulines: + def __call__(self, v): + if hasattr(v,'read'): + v=v.read() + if isinstance(v, (ListType, TupleType)): + return [field2ustring(x) for x in v] + v = unicode(v) + return self.convert_unicode(v) + + def convert_unicode(self, v): + return field2utext.convert_unicode(v).splitlines() + field2ulines = field2ulines() type_converters = { _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins