Commit cadf4598 authored by Tres Seaver's avatar Tres Seaver

Collector #2263: 'field2ulines' did not convert empty string correctly.

o Forward-port from 2.8 branch.
parent b6873816
...@@ -154,9 +154,18 @@ class field2utext(_unicode_converter): ...@@ -154,9 +154,18 @@ class field2utext(_unicode_converter):
return unicode(field2text(v.encode('utf8')),'utf8') return unicode(field2text(v.encode('utf8')),'utf8')
field2utext = field2utext() field2utext = field2utext()
class field2ulines(_unicode_converter): class field2ulines:
def convert_unicode(self,v): def __call__(self, v):
return field2utext.convert_unicode(v).split('\n') 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() field2ulines = field2ulines()
type_converters = { type_converters = {
......
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