how do i make a python script ?
hello, i have this z-class with a text element and i'd like to parse this text before displaying it ? say, evrytime there is "zope" written in it i'd like to replace it on the fly with <b>zope</b>. i think the right direction to look at is a script (a pythonscript ?) that would be called as a method on this element. am i right or a i wrong ? what would the best starting point be ? thx $ven
Sven Fischer writes:
i have this z-class with a text element and i'd like to parse this text before displaying it ? say, evrytime there is "zope" written in it i'd like to replace it on the fly with <b>zope</b>.
i think the right direction to look at is a script (a pythonscript ?) that would be called as a method on this element. am i right or a i wrong ? what would the best starting point be ? Python Script and the "re" module:
* you search the mailing list archive on how you enable "re" for use in Python Scripts ("import re" raises "Unauthorized" by default) * you look in the Python library reference about regular expressions and the "sub" method. If you want to just replace words, you can use "string.replace" instead of "re". You would not need to learn how to make "re" available in Scripts. Dieter
participants (2)
-
Dieter Maurer -
Sven Fischer