[Checkins] SVN: zope.app.authentication/trunk/src/zope/app/authentication/ Substitute zope.app.zapi by direct calls to its wrapped apis. See bug 219302

Lorenzo Gil lgs at sicem.biz
Sun Apr 20 05:56:12 EDT 2008


Log message for revision 85500:
  Substitute zope.app.zapi by direct calls to its wrapped apis. See bug 219302

Changed:
  U   zope.app.authentication/trunk/src/zope/app/authentication/browser/adding.py
  U   zope.app.authentication/trunk/src/zope/app/authentication/browser/groupfolder.txt
  U   zope.app.authentication/trunk/src/zope/app/authentication/browser/schemasearch.py
  U   zope.app.authentication/trunk/src/zope/app/authentication/groupfolder.py
  U   zope.app.authentication/trunk/src/zope/app/authentication/principalfolder.py

-=-
Modified: zope.app.authentication/trunk/src/zope/app/authentication/browser/adding.py
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/browser/adding.py	2008-04-20 09:40:55 UTC (rev 85499)
+++ zope.app.authentication/trunk/src/zope/app/authentication/browser/adding.py	2008-04-20 09:56:11 UTC (rev 85500)
@@ -16,12 +16,11 @@
 $Id$
 """
 
-from zope.app import zapi
-
 import zope.app.container.browser.adding
 
+from zope.traversing.browser.absoluteurl import absoluteURL
+
 class Adding(zope.app.container.browser.adding.Adding):
-    
+
     def nextURL(self):
-        return zapi.absoluteURL(self.context, self.request
-                                ) + '/@@contents.html'
+        return absoluteURL(self.context, self.request) + '/@@contents.html'

Modified: zope.app.authentication/trunk/src/zope/app/authentication/browser/groupfolder.txt
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/browser/groupfolder.txt	2008-04-20 09:40:55 UTC (rev 85499)
+++ zope.app.authentication/trunk/src/zope/app/authentication/browser/groupfolder.txt	2008-04-20 09:56:11 UTC (rev 85500)
@@ -639,8 +639,9 @@
 
 and we'll get the pluggable authentication utility:
 
-  >>> from zope.app import zapi
-  >>> principals = zapi.principals()
+  >>> from zope.component import getUtility
+  >>> from zope.app.security.interfaces import IAuthentication
+  >>> principals = getUtility(IAuthentication)
 
 Finally we'll get Betty and see that she is in the admin and
 power-user groups:

Modified: zope.app.authentication/trunk/src/zope/app/authentication/browser/schemasearch.py
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/browser/schemasearch.py	2008-04-20 09:40:55 UTC (rev 85499)
+++ zope.app.authentication/trunk/src/zope/app/authentication/browser/schemasearch.py	2008-04-20 09:56:11 UTC (rev 85500)
@@ -20,11 +20,11 @@
 from zope.interface import implements
 from zope.i18n import translate
 from zope.schema import getFieldsInOrder
-from zope.app.zapi import getName, getPath
 from zope.app.form.utility import setUpWidgets, getWidgetsData
 from zope.app.form.interfaces import IInputWidget
 from zope.app.form.browser.interfaces import ISourceQueryView
 from zope.app.authentication.i18n import ZopeMessageFactory as _
+from zope.traversing.api import getName, getPath
 
 
 search_label = _('search-button', 'Search')

Modified: zope.app.authentication/trunk/src/zope/app/authentication/groupfolder.py
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/groupfolder.py	2008-04-20 09:40:55 UTC (rev 85499)
+++ zope.app.authentication/trunk/src/zope/app/authentication/groupfolder.py	2008-04-20 09:56:11 UTC (rev 85500)
@@ -24,13 +24,13 @@
 from zope.security.interfaces import (
     IGroup, IGroupAwarePrincipal, IMemberAwareGroup)
 
-from zope.app import zapi
 from zope.app.container.btree import BTreeContainer
 import zope.app.container.constraints
 import zope.app.container.interfaces
 from zope.app.authentication.i18n import ZopeMessageFactory as _
 import zope.app.security.vocabulary
-from zope.app.security.interfaces import IAuthenticatedGroup, IEveryoneGroup
+from zope.app.security.interfaces import (
+    IAuthentication, IAuthenticatedGroup, IEveryoneGroup)
 from zope.app.authentication import principalfolder, interfaces
 
 
@@ -293,7 +293,8 @@
 
             if check:
                 try:
-                    nocycles(new, [], zapi.principals().getPrincipal)
+                    principalsUtility = component.getUtility(IAuthentication)
+                    nocycles(new, [], principalsUtility.getPrincipal)
                 except GroupCycle:
                     # abort
                     self.setPrincipals(old, False)

Modified: zope.app.authentication/trunk/src/zope/app/authentication/principalfolder.py
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/principalfolder.py	2008-04-20 09:40:55 UTC (rev 85499)
+++ zope.app.authentication/trunk/src/zope/app/authentication/principalfolder.py	2008-04-20 09:56:11 UTC (rev 85500)
@@ -24,7 +24,6 @@
 from zope.schema import Text, TextLine, Password, Choice
 from zope.publisher.interfaces import IRequest
 
-from zope.app import zapi
 from zope.app.container.interfaces import DuplicateIDError
 from zope.app.container.contained import Contained
 from zope.app.container.constraints import contains, containers
@@ -141,7 +140,7 @@
     passwordManagerName = property(getPasswordManagerName)
 
     def _getPasswordManager(self):
-        return zapi.getUtility(
+        return component.getUtility(
             interfaces.IPasswordManager, self.passwordManagerName)
 
     def getPassword(self):



More information about the Checkins mailing list