Title: practical example of migrating from services to utilities

Hello All,
        I have a method which is working well in zope3.0 but its not working well in Zope3.1 c2 version.
        I am new to zope3 framework.I think services have no support in zope3.1.what do i need to do to make it work.
        I think i have to use either adpaters or utilities for this task.
        Somebody please send me a cod snippet to make it work.

        I am putting my code snippet below

        from zope.app.publisher.browser import BrowserView
        from zope.app.exception.interfaces import UserError
        from zope.app.pluggableauth.interfaces import IPluggableAuthentication
        from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
        _ = MessageIDFactory('mynewsite')

        from mynewsite.interfaces import ISignupPrincipalSource

        def _getPrincipalSource(self):
                        # I am getting error at below place when signing up
                        pluggableauth = zapi.getService(zapi.servicenames.Authentication,context=self.context)
                        if not IPluggableAuthentication.providedBy(pluggableauth):
                                raise LookupError, "Signup requires a pluggableauth instance."
                        for principal_source in pluggableauth.values():
                                if ISignupPrincipalSource.providedBy(principal_source):
                                        return principal_source
                        raise TypeError, "Signup requires a SignupPrincipalSource."
        Thanks in advance
-Nagendra Kumar

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to