The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From: "Cecil Westerhof" <cldwester...@gmail.com>
Date: Tue, 13 May 2008 11:35:12 +0200
Local: Tues, May 13 2008 5:35 am
Subject: Re: [TurboGears] Re: Preserving newlines
2008/5/13 Daniel Fetchinson <fetchin...@googlemail.com>:
> And if this part of your code becomes the real performance bottleneck I do not think this will be the bottleneck. Displaying is offcourse > you might want to do the search/replace using the re module. Take a > look at xml.etree.ElementTree in the stdlib for an example (if you > have python > 2.4). what is done most, but retreiving the values from the database is more expensive as the replacements I think. But it never hurts to think about performance I think. So I made it like: ##### startSpaces = re.compile(' +') def splitLines(thisText): if thisText == None: return None thisText = xml.etree.ElementTree._encode_entity(thisText) lines = thisText.split('\n') for i in range(len(lines)): match = startSpaces.match(lines[i]) if match: lines[i] = ' ' * match.end() + lines[i][match.end():] return '<br/>'.join(lines) ##### With xml.etree.ElementTree._encode_entity the conversion is done more -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||