[ZCM] [ZC] 2263/ 1 Request "ZPublisher.Converters inconsistent handling for lines and ulines conversion and empty field"

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]>
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2263 Update (Request) "ZPublisher.Converters inconsistent handling for lines and ulines conversion and empty field"
 Status Pending, Zope/bug+solution medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2263

==============================================================
= Request - Entry #1 by pperegrina on Jan 11, 2007 7:58 am

BUG

The conversion of fields of type lines and ulines is different when the field is empty.
1)lines
def field2lines(v):
    if isinstance(v, (ListType, TupleType)):
        result=[]
        for item in v:
            result.append(str(item))
        return result
    return field2text(v).splitlines()
2)ulines
class field2ulines(_unicode_converter):
    def convert_unicode(self,v):
        return field2utext.convert_unicode(v).split('\n')
field2ulines = field2ulines()

SOLUTION

in ulines, change :
field2utext.convert_unicode(v).split('\n')
to:
field2utext.convert_unicode(v).splitlines()


==============================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.