[Zope] Using the replace function in a Zope Python Script

Gitte Wange gitte@babytux.dk
Thu, 16 Aug 2001 18:34:12 +0200


At 17:21 16-08-2001 +0100, you wrote:
>
>> Have you tried:
>> import string
>> 
>> return string.replace("flubbery", "flub", "shrub")
>
>Alternatively you can use the under namespace:
>
>return _.string.replace("flubbery", "flub", "shrub")
>
>although you'll first need to go to the python script object's
>"Bindings" tab and bind _ as the namespace (which is the
>recommended value anyway).
>
>I'm not sure if/why this is better than the way mentioned above,
>mind. :-)
>
>-Andy
>

Well the reason why I need this function is that I just discovered today
that a username in Zope can contain spaces - and that's not a good idea
when we create file names (in FS) from users login name ...

Is spaces really allowed in usernames ?

Regards,
Gitte Wange