Daniel Fetchinson schrieb:
> You might want to add " to your list. And if in the majority of
> cases thisText doesn't contain the special characters the following
> will be better performance-wise:
>
> def splitLines(thisText):
> if thisText == None:
> return []
> if '&' in thisText: thisText = thisText.replace('&', '&')
> if '<' in thisText: thisText = thisText.replace('<', '<')
> if '>' in thisText: thisText = thisText.replace('>', '>')
> if '"' in thisText: thisText = thisText.replace('"', '"' )
> return '<br/>'.join(thisText.split('\n'))
There is also a function cgi.escape for doing this in the standard lib.
-- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---