Florian Lindner wrote:
> Hello,
> I've this piece of working code which generates deprecation warnings with the 
> new API:
> registration = UtilityRegistration("cs users", 
> zope.app.authentication.interfaces.IAuthenticatorPlugin, principal_folder)
> registration_manager = pau.registrationManager
> registration_manager.addRegistration(registration)
> registration.status = u'Active'

Right. This is the "baroque" registration API and deprecated in Zope
3.3/the trunk (in the future, please state which Zope version you're

> My problem is: where do I get a class instance that implements 
> zope.component.interfaces.IComponentRegistry? (which is AFAIK needed for the 
> new registration)

IComponentRegistry is implemented by site managers. So you should be
able to go the site manager of your nearest site and simply say:

  >>> sm = site.getSiteManager()
  >>> sm.registerUtility(principal_folder, IAuthenticatorPlugin,
  ...                    "cs_users")

zope.traversing.api.getSite gets you to the nearest site, for example.


Zope3-users mailing list

Reply via email to