"Jens W. Klein" <[email protected]>
writes:

> Author: jensens
> Date: Thu Apr 23 07:54:20 2009
> New Revision: 84945
>
> Modified:
>    Products.remember/trunk/Products/remember/config.py
>    Products.remember/trunk/Products/remember/content/member.py
> Log:
> allow usage of portal_registration tools
> ALLOWED_MEMBER_ID_PATTERN. This does not change any current behaviour,
> it may be made configurable ttw in future. Introduced new config.py
> variable USE_PORTAL_REGISTRATION_PATTERN set to False by
> default. Setting to True switches to portal_registrations
> getIDPattern.

Thanks for the contribution!

Jens, can you tell me more about regtool.getIDPattern?  I'm not familiar
with it.

Jens, or anyone else here, any reason this shouldn't be the default
behavior?  If there are no objections, I'd rather deprecate the remember
pattern support than support both with a configuration variable.

Finally, where's the test?  :)

Ross

> Modified: Products.remember/trunk/Products/remember/config.py
> ==============================================================================
> --- Products.remember/trunk/Products/remember/config.py       (original)
> +++ Products.remember/trunk/Products/remember/config.py       Thu Apr 23 
> 07:54:20 2009
> @@ -19,6 +19,7 @@
>  DEFAULT_MEMBER_TYPE = 'Member'
>  
>  ALLOWED_MEMBER_ID_PATTERN = re.compile( "^[A-Za-z][A-Za-z0-9_]*$" )
> +USE_PORTAL_REGISTRATION_PATTERN = False
>  
>  AUTO_ROLES = ('Anonymous', 'Authenticated')
>  
>
> Modified: Products.remember/trunk/Products/remember/content/member.py
> ==============================================================================
> --- Products.remember/trunk/Products/remember/content/member.py       
> (original)
> +++ Products.remember/trunk/Products/remember/content/member.py       Thu Apr 
> 23 07:54:20 2009
> @@ -1,4 +1,5 @@
>  import sys
> +import re
>  
>  from AccessControl import ClassSecurityInfo
>  from AccessControl import Unauthorized
> @@ -40,6 +41,7 @@
>  from Products.remember.interfaces import IRememberUserChanger
>  
>  from Products.remember.config import ALLOWED_MEMBER_ID_PATTERN
> +from Products.remember.config import USE_PORTAL_REGISTRATION_PATTERN
>  from Products.remember.config import DEFAULT_MEMBER_TYPE
>  from Products.remember.config import ANNOT_KEY
>  from Products.remember.config import HASHERS
> @@ -89,6 +91,7 @@
>      listed = 0
>  
>      default_roles = ('Member',)
> +    
>  
>      security.declarePrivate('setId')
>      def setId(self, value):
> @@ -158,9 +161,13 @@
>          elif self.id and id != self.id:
>              # we only validate if we're changing the id
>              mbtool = getToolByName(self, 'membrane_tool')
> -            if mbtool.getUserAuthProvider(id) is not None or \
> -                   not ALLOWED_MEMBER_ID_PATTERN.match(id) or \
> -                   id == 'Anonymous User':
> +            PATTERN = ALLOWED_MEMBER_ID_PATTERN
> +            if USE_PORTAL_REGISTRATION_PATTERN:
> +                regtool = getToolByName(self, 'portal_registration')
> +                PATTERN = re.compile(regtool.getIDPattern())
> +            if mbtool.getUserAuthProvider(id) is not None \
> +               or not PATTERN.match(id) \
> +               or id == 'Anonymous User':
>                  msg = "The login name you selected is already " + \
>                        "in use or is not valid. Please choose another."
>                  return self.translate(msg, default=msg)
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and 
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today. 
> Use priority code J9JMT32. http://p.sf.net/sfu/p



--
Archive: 
http://www.openplans.org/projects/remember/lists/remember/archive/2009/04/1240514971940
To unsubscribe send an email with subject "unsubscribe" to 
[email protected].  Please contact 
[email protected] for questions.

Reply via email to