[ZCM] [ZC] 1126/ 2 Resolve "ZPublisher.Converters.field2lines() should use splitlines(), not split('\n')"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Mon May 17 13:34:04 EDT 2004


Issue #1126 Update (Resolve) "ZPublisher.Converters.field2lines() should use splitlines(), not split('\n')"
 Status Resolved, Zope/bug+solution medium
To followup, visit:
  http://zope.org/Collectors/Zope/1126

==============================================================
= Resolve - Entry #2 by ajung on May 17, 2004 1:34 pm

 Status: Pending => Resolved

Fixed in 2.7 branch + SVN trunk.
________________________________________
= Request - Entry #1 by dchandek on Nov 18, 2003 10:19 am

from ZPublisher.Converters:

>def field2lines(v):
>    if type(v) in (ListType, TupleType):
>        result=[]
>        for item in v:
>            result.append(str(item))
>        return result
>    return field2text(v).split('\n')

Last line of function should be:

>    return field2text(v).splitlines()

Reason: 

>>> s = ''
>>> s.split('\n')
 ['']
>>> s.splitlines()
 []

Then you could, for example, write ZPT:

    tal:condition="object/lines_property"
==============================================================




More information about the Zope-Collector-Monitor mailing list