[Zope] Checking string for specific characters

Robert Rottermann robert@redcor.ch
Mon, 8 Oct 2001 15:30:24 +0200


bad =' ()[]{}ÄÅÁÀÂÃäåáàâãÇçÉÈÊËéèêëæÍÌÎÏíìîïÑñÖÓÒÔÕØöóòôõøSsßÜÚÙÛüúùûÝYýÿ??'
good='_______AAAAAAaaaaaaCcEEEEeeeeeIIIIiiiiNnOOOOOOooooooSssUUUUuuuuYYyyZz'
TRANSMAP=string.maketrans(bad, good)
def fixId(anId):
  anId = string.translate(anId, TRANSMAP)

stolen with trembling fingers from CMFOptions

Robert

----- Original Message -----
From: "Gitte Wange" <gitte@mmmanager.org>
To: "Zope mailinglist" <zope@zope.org>
Sent: Monday, October 08, 2001 10:44 AM
Subject: [Zope] Checking string for specific characters


> Hello,
>
> I need to create some filenames from the titles of some objects.
> In order to make these filenames correct, I need to create a function
> that checks the title string in order to see if there are any
> "non-allowed" characters in the string and strip them.
>
> Right know I am doing a string.replace for the characters that aren't
> allowed, but it would be much easier to specify what characters that
> _is_ allowed.
>
> I guess the function that adds a new object to Zope does it ... but I
> cannot find that function.
>
> --
> Gitte Wange Jensen
>
> Sys Admin, Developer and a lot more
> MMmanager.org Aps, Denmark
>
> Phone: +45 29 72 79 72
> Email: gitte@mmmanager.org
> Web: www.mmmanager.org
>
> Quote of the day:
> I strongly believe that trying to be clever is detrimental to your
> health.
>
>     - Linus Torvalds
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>