[Zope] Adding Folders and index_html from Python Script
Tim Cook
tim@freepm.org
Sat, 24 Mar 2001 15:02:48 -0600
complaw@hal-pc.org wrote:
> As an asisde, I want to make the id of the folder a string that contains only
> allowable characters that are taken from the name that the users input (with an
> _ used in place of the blanks). Is there a quick easy way to do that with some
> library function that isn't showing up in the Python Library Reference at
> www.python.org?
Because I only worry about spaces in this situation, I use:
<dtml-call "REQUEST.set('id',
_.string.capitalize(_.string.replace(med_name,' ', '_')))">
(Yes I know I shouldn't do this in DTML, but I didn't know better
when I wrote it. <s>)
To convert all non-legal characters you would need to use
"maketrans". You should be able to find it in any good Python
reference.
HTH,
--
Tim Cook, President - FreePM,Inc.
http://www.FreePM.com Office: (901) 884-4126
ONLINE DEMO: http://www.freepm.org:8080/FreePM