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

2009-01-12 Thread Chris Withers
Douglas Cerna wrote:
> Try to remove the utility from the sm like this:
> 
> del sm['authentication']

Eh? You shouldn't have do delete it just because you want to un-register it.

I wonder why Sebastian's unregisterUtility didn't work?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


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

2009-01-10 Thread Douglas Cerna
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  wrote:

> From: Sebastian Bartos 
> Subject: [Zope3-Users] How do I get rid of a PAU with the API?
> To: "Zope3 Users" 
> 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, 
> keyserevr: pgp.mit.edu
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


  

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


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

2009-01-10 Thread Sebastian Bartos
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, 
keyserevr: pgp.mit.edu


signature.asc
Description: This is a digitally signed message part
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users