Changeset 3476:b6bd2d0d98e3 in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/09/08 21:12:58 (11 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Escape "\n" in csvescape() too. Fix test.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/ll/ul4c.py

    r3475 r3476  
    23202320    elif not isinstance(obj, basestring): 
    23212321        obj = _repr(obj) 
    2322     if "," in obj or '"' in obj: 
     2322    if any(c in obj for c in ',"\n'): 
    23232323        return u'"%s"' % obj.replace('"', '""') 
    23242324    return obj 
  • test/test_ul4.py

    r3475 r3476  
    466466    check("abc", "<?print csvescape(data)?>", data="abc") 
    467467    check('"a,b,c"', "<?print csvescape(data)?>", data="a,b,c") 
    468     check('a""b""c', "<?print csvescape(data)?>", data='a"b"c') 
     468    check('"a""b""c"', "<?print csvescape(data)?>", data='a"b"c') 
     469    check('"a\nb\nc"', "<?print csvescape(data)?>", data="a\nb\nc") 
    469470 
    470471