[Zope3-Users] How do I get rid of a PAU with the API?

Sebastian Bartos seth.kriticos at googlemail.com
Sat Jan 10 13:29:23 EST 2009


Hello,
now that I have registered the PAU, I also want to add a removal part.

The creation part was this:

...
    def RenderRunOutput(self):
        """ Do the setup and output the result. """
        
        # Check for existing install        
        
        site = getSite()
        sm = site.getSiteManager()
        
        if sm.has_key('authentication'):
            return "Site is already set up"
        
        # Run istallation of pluggable authentication
        
        pau = PluggableAuthentication()
        sm['authentication'] = pau
        sm.registerUtility(pau, IAuthentication)
        users = PrincipalFolder()
        sm['authentication']['Users'] = users
        sm.registerUtility(users, IAuthenticatorPlugin, name="Users")
        pau.authenticatorPlugins = (users.__name__, )
        pau.credentialsPlugins = ( "No Challenge if Authenticated", 
                                   "Session Credentials" )
        
        return "Setup sucessfully ran!"
...


Now I try to do the following:


...

    def RenderRemoveOutput(self):
        """ Remove the PAU. """

        site = getSite()
        sm = site.getSiteManager()
        
       
        sm.unregisterUtility(sm['authentication']['Users'],
IAuthenticatorPlugin)
        sm.unregisterUtility(sm['authentication'], IAuthentication)
        
        return "to be removed"

...

This runs, but the utility does not disappear. 
So, how can I make it go away?

-- 
Sebastian Bartos, <seth.kriticos at googlemail.com>
keyserevr: pgp.mit.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20090110/a926c3e3/attachment.bin 


More information about the Zope3-users mailing list