[Zope] newline in string arg to python script

Lee Harr missive@hotmail.com
Sun, 23 Mar 2003 19:23:58 +0000


Hi;


# Python Script show_string
# parameters: s=''
print s
print list(s)
print [ord(c) for c in list(s)]
return printed
# end



# dtml method:
<dtml-var "show_string('what happens
to my
newlines?')">
# end


This returns:

what happens to my newlines?
['w', 'h', 'a', 't', ' ', 'h', 'a', 'p', 'p', 'e', 'n', 's', ' ', 't', 'o', 
' ', 'm', 'y', ' ', 'n', 'e', 'w', 'l', 'i', 'n', 'e', 's', '?']
[119, 104, 97, 116, 32, 104, 97, 112, 112, 101, 110, 115, 32, 116, 111, 32, 
109, 121, 32, 110, 101, 119, 108, 105, 110, 101, 115, 63]


The newlines have been converted to spaces.
How can I tell a space from a newline?

My final goal is to inline some python code without having to
use a bunch of &nbsp;&nbsp; in each snippet.

Anyone have a clue for me?  :o)


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963