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

Douglas Cerna douglascerna at yahoo.com
Sat Jan 10 14:35:13 EST 2009


Try to remove the utility from the sm like this:

del sm['authentication']

Hope this helps.

Douglas

"... allí­ es cuando te das cuenta que las cosas malas pueden resultar bastante buenas..." - Lionel Messi

Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
Vea http://www.gnu.org/philosophy/no-word-attachments.es.html


--- On Sat, 1/10/09, Sebastian Bartos <seth.kriticos at googlemail.com> wrote:

> From: Sebastian Bartos <seth.kriticos at googlemail.com>
> Subject: [Zope3-Users] How do I get rid of a PAU with the API?
> To: "Zope3 Users" <zope3-users at zope.org>
> Date: Saturday, January 10, 2009, 10:29 AM
> 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
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


      



More information about the Zope3-users mailing list