Message7370

Author dougxc
Recipients abuehl, djc, jwwalker, tonfa
Date 2008-10-09.21:04:09
Content
I have had a similar issue when trying to use {files|tabindent} in a template.
It crashed hg with:

AttributeError: 'generator' object has no attribute 'splitlines'

To fix this, I added a new filter in templatefilters.py:

    "ws2nl": lambda x: re.sub('\s+', '\n', x),

that simply replaces one or more white spaces with a single newline. Now
I get the effect I want with {files|stringify|ws2nl|tabindent} in my template.
I'd like to propose adding this filter to the official HG sources but am not
sure what the process is.
History
Date User Action Args
2008-10-09 21:04:09dougxcsetrecipients: + tonfa, djc, abuehl, jwwalker
2008-10-09 21:04:09dougxcsetmessageid: <1223586249.79.0.0888225468046.issue1164@selenic.com>
2008-10-09 21:04:09dougxclinkissue1164 messages
2008-10-09 21:04:09dougxccreate