PAS plugin - setting member properties

Jordan Baker jbb at
Thu Oct 18 14:26:46 UTC 2007

I'm writing a little PAS plugin to enable password expiration.

When I set the property in my handler it seems to work but when it 
returns back to the caller the property values have reverted.  For 

     def updateCredentials(self, request, response, login, new_password):
         mtool = getToolByName(self, 'portal_membership', None)
         if not mtool:
         member = mtool.getMemberById(login)
         if not member:
         last_password_change = member.getProperty('last_password_change')
         expired = (not last_password_change) or (DateTime() - 
DateTime(last_password_change)  > 60)
         if expired:
             assert member.getProperty('must_change_password') == True

This gives me no errors.  But my functional doctest fails:

Try to login now and the system should set must_change_password.  Also 
we should receive a status message

   >>> browser.getLink('Log in').click()
   >>> browser.getControl(name='__ac_name').value = PTC.default_user
   >>> browser.getControl(name='__ac_password').value = PTC.default_password
   >>> browser.getControl(name='submit').click()

   This isn't true black box testing but it is nice to check the 
implementation somewhat as well.
   >>> member.getProperty('must_change_password')

Is this indeed possible ? I can't see any reason why I shouldn't be able 
to set member properties from the PAS property unless there is some 
collision using a PAS plugin (memberdata) from another PAS plugin?



More information about the Product-Developers mailing list