[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/security/ cleanup
imports, soft dep for testing cleanup
Bernd Dorn
bernd.dorn at lovelysystems.com
Mon Mar 26 10:31:31 EDT 2007
Log message for revision 73630:
cleanup imports, soft dep for testing cleanup
Changed:
U Zope3/trunk/src/zope/app/security/browser/configure.zcml
U Zope3/trunk/src/zope/app/security/interfaces.py
U Zope3/trunk/src/zope/app/security/metadirectives.py
U Zope3/trunk/src/zope/app/security/principalregistry.py
U Zope3/trunk/src/zope/app/security/tests/test_directives.py
U Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py
U Zope3/trunk/src/zope/app/security/tests/test_protectclass.py
U Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py
U Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py
U Zope3/trunk/src/zope/app/security/vocabulary.py
-=-
Modified: Zope3/trunk/src/zope/app/security/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/configure.zcml 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/browser/configure.zcml 2007-03-26 14:31:31 UTC (rev 73630)
@@ -53,7 +53,7 @@
<browser:addform
name="AddPermission.html"
- schema="..interfaces.IPermission"
+ schema="zope.security.interfaces.IPermission"
label="Add Permission"
content_factory="..permission.LocalPermission"
fields="title description"
@@ -69,7 +69,7 @@
/>
<browser:editform
- schema="..interfaces.IPermission"
+ schema="zope.security.interfaces.IPermission"
label="Edit Permission"
name="edit.html"
permission="zope.ManageServices"
Modified: Zope3/trunk/src/zope/app/security/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/security/interfaces.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/interfaces.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -16,7 +16,6 @@
$Id$
"""
from zope.interface import Interface
-from zope.schema import Text, TextLine
from zope.security.interfaces import IPrincipal, IPermission, IGroup
from zope.schema.interfaces import ISource
Modified: Zope3/trunk/src/zope/app/security/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/metadirectives.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/metadirectives.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -18,7 +18,7 @@
from zope.interface import Interface
from zope.configuration.fields import GlobalObject, GlobalInterface
from zope.configuration.fields import Tokens, PythonIdentifier
-from zope.schema import InterfaceField, Id, TextLine
+from zope.schema import Id, TextLine
from zope.security.zcml import Permission
##############################################################################
Modified: Zope3/trunk/src/zope/app/security/principalregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/security/principalregistry.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/principalregistry.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -20,7 +20,7 @@
from zope.app.authentication.interfaces import IPasswordManager
from zope.app.security.interfaces import PrincipalLookupError
from zope.app import zapi
-from zope.security.interfaces import IPrincipal, IGroupAwarePrincipal
+from zope.security.interfaces import IGroupAwarePrincipal
from zope.app.security import interfaces
from zope.app.container.contained import Contained, contained
@@ -126,10 +126,15 @@
principalRegistry = PrincipalRegistry()
-# Register our cleanup with Testing.CleanUp to make writing unit tests simpler.
-from zope.testing.cleanup import addCleanUp
-addCleanUp(principalRegistry._clear)
-del addCleanUp
+# Register our cleanup with Testing.CleanUp to make writing unit tests
+# simpler.
+try:
+ from zope.testing.cleanup import addCleanUp
+except ImportError:
+ pass
+else:
+ addCleanUp(principalRegistry._clear)
+ del addCleanUp
class PrincipalBase(Contained):
Modified: Zope3/trunk/src/zope/app/security/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_directives.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/tests/test_directives.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -21,12 +21,8 @@
import zope.security.zcml
from zope.interface import Interface, Attribute
from zope.testing import doctest
-from zope.component import provideUtility
from zope.component.testing import setUp, tearDown, PlacelessSetup
from zope.configuration import xmlconfig
-from zope.security.checker import moduleChecker
-from zope.security.permission import Permission
-from zope.security.interfaces import IPermission
from zope.app.security import metaconfigure
@@ -47,9 +43,14 @@
def test_protectModule():
"""
>>> from zope.app.security.tests import test_directives
+ >>> from zope.security.interfaces import IPermission
+ >>> from zope.security.permission import Permission
+ >>> from zope.component import provideUtility
+
Initially, there's no checker defined for the module:
+ >>> from zope.security.checker import moduleChecker
>>> moduleChecker(test_directives)
>>> perm = Permission(test_perm, '')
Modified: Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -20,7 +20,6 @@
from zope.app.security.interfaces import PrincipalLookupError
from zope.publisher.interfaces.http import IHTTPCredentials
-from zope.app import zapi
from zope.app.testing import ztapi
from zope.app.component.testing import PlacefulSetup
Modified: Zope3/trunk/src/zope/app/security/tests/test_protectclass.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_protectclass.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/tests/test_protectclass.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -22,7 +22,7 @@
from zope.app.testing import ztapi
from zope.app.testing.placelesssetup import PlacelessSetup
-from zope.app.security.interfaces import IPermission
+from zope.security.interfaces import IPermission
from zope.app.security.protectclass import protectName, protectLikeUnto
from zope.app.security.protectclass import protectSetAttribute
from zope.app.security.tests.modulehookup import *
Modified: Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -21,7 +21,7 @@
from zope.app.testing import ztapi
from zope.app.testing.placelesssetup import PlacelessSetup
-from zope.app.security.interfaces import IPermission
+from zope.security.interfaces import IPermission
from zope.app.security.protectclass import protectName
class Test(PlacelessSetup, unittest.TestCase):
Modified: Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -23,7 +23,8 @@
from zope.app.testing import ztapi
from zope.app.testing.placelesssetup import PlacelessSetup
-from zope.app.security.interfaces import IAuthentication, IPermission
+from zope.security.interfaces import IPermission
+from zope.app.security.interfaces import IAuthentication
from zope.app.security.principalregistry import principalRegistry
import zope.app.security.tests
Modified: Zope3/trunk/src/zope/app/security/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/security/vocabulary.py 2007-03-26 13:50:50 UTC (rev 73629)
+++ Zope3/trunk/src/zope/app/security/vocabulary.py 2007-03-26 14:31:31 UTC (rev 73630)
@@ -60,7 +60,7 @@
We also need to register some sample permission utilities, including
the special permission 'zope.Public':
- >>> from zope.app.security.interfaces import IPermission
+ >>> from zope.security.interfaces import IPermission
>>> from zope.security.permission import Permission
>>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IPermission, Permission('zope.Public'),
More information about the Zope3-Checkins
mailing list