[ZCM] [ZC] 2263/ 5 Resolve "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 (Resolve) "ZPublisher.Converters inconsistent handling for lines and ulines conversion and empty field"
Status Resolved, Zope/bug+solution medium
To followup, visit:
http://www.zope.org/Collectors/Zope/2263
==============================================================
= Resolve - Entry #5 by tseaver on Jan 11, 2007 4:48 pm
Status: Accepted => Resolved
Patch checked in, with tests, on the 2.8 branch:
http://svn.zope.org/Zope/branches/Zope-2_8-branch/?rev=71936&view=rev
the 2.9 branch:
http://svn.zope.org/Zope/branches/2.9/?rev=71939&view=rev
the 2.10 branch:
http://svn.zope.org/Zope/branches/2.10/?rev=71941&view=rev
and the trunk:
http://svn.zope.org/Zope/trunk/?rev=71943&view=rev
________________________________________
= Comment - Entry #4 by tseaver on Jan 11, 2007 3:44 pm
Uploaded: "issue_2263.patch"
- http://www.zope.org/Collectors/Zope/2263/issue_2263.patch/view
Patch with tests.
________________________________________
= Accept - Entry #3 by tseaver on Jan 11, 2007 12:48 pm
Status: Pending => Accepted
Supporters added: tseaver
Thanks for the report! I can see how to add a test for this, and
fix it.
________________________________________
= Comment - Entry #2 by pperegrina on Jan 11, 2007 8:03 am
Illustration of the difference:
LINES
>>> ''.splitlines()
[]
ULINES BUG
>>> u''.split('\n')
[u'']
ULINES SOLUTION
>>> u''.splitlines()
[]
________________________________________
= 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()
==============================================================