[Zope-CMF] RE: Help- cmf version problem

Florent Guillaume fg@nuxeo.com
Fri, 7 Jun 2002 15:37:20 +0000 (UTC)


David (Hamish) Harvey <david.harvey@bristol.ac.uk> wrote:
> and found that all of the restrictions on user names are defined in 
> CMFCore/RegistrationTool.py - there is a line like
> 
>     __ALLOWED_MEMBER_ID_PATTERN = re.compile( "^[A-Za-z][A-Za-z0-9_]*$" )
> 
> I've modified it to
> 
>     __ALLOWED_MEMBER_ID_PATTERN = re.compile( "^[A-Za-z][A-Za-z0-9_\.\-]*$" 
> )
> 
> which allows . and - as characters in the username. I haven't worked out 
> how to override this without modiying the source code in CMFCore yet, 
> though.

In one of your products, in __init__.py, just do:

import re
from Products.CMFCore.RegistrationTool import RegistrationTool
RegistrationTool.__ALLOWED_MEMBER_ID_PATTERN = \
    re.compile(r"^[A-Za-z][A-Za-z0-9_\.\-]*$")

(Beware, you got the regexp syntax wrong regarding backslashes, you
should use raw strings like I did.)

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com