[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/ Merged
from trunk
Jim Fulton
jim at zope.com
Tue Jul 27 10:33:50 EDT 2004
Log message for revision 26792:
Merged from trunk
r26787 | jim | 2004-07-27 10:00:42 -0400 (Tue, 27 Jul 2004) | 4 lines
Moved forbidden and unauthorized exception definitions to
zope.security.interfaces.
Changed:
U Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/tests/test_adding.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/debugskin/configure.zcml
U Zope3/branches/ZopeX3-3.0/src/zope/app/exception/browser/configure.zcml
U Zope3/branches/ZopeX3-3.0/src/zope/app/http/exception/configure.zcml
U Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/tests/test_zopepythonexpr.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/globalbrowsermenuservice.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_icondirective.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_row.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/tests/functional.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test_decorator.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/tests/test_traverser.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/undo/browser.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/tests/test_zptpage.py
U Zope3/branches/ZopeX3-3.0/src/zope/exceptions/__init__.py
D Zope3/branches/ZopeX3-3.0/src/zope/exceptions/_forbidden.py
D Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py
U Zope3/branches/ZopeX3-3.0/src/zope/publisher/interfaces/__init__.py
U Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c
U Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py
U Zope3/branches/ZopeX3-3.0/src/zope/security/interfaces.py
U Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_builtins.py
U Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_checker.py
U Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_standard_checkers.py
U Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/server.py
U Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/demofs.py
-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -18,7 +18,7 @@
import unittest
from cStringIO import StringIO
-from zope.exceptions import Forbidden, Unauthorized
+from zope.security.interfaces import Forbidden, Unauthorized
from zope.configuration.xmlconfig import testxmlconfig as xmlconfig, XMLConfig
from zope.configuration.config import ConfigurationConflictError
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/contents.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -16,7 +16,8 @@
$Id$
"""
-from zope.exceptions import NotFoundError, Unauthorized
+from zope.exceptions import NotFoundError
+from zope.security.interfaces import Unauthorized
from zope.security import checkPermission
from zope.app import zapi
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/tests/test_adding.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/tests/test_adding.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/tests/test_adding.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -24,7 +24,7 @@
from zope.interface import implements, Interface, directlyProvides
from zope.publisher.browser import TestRequest
import zope.security.checker
-from zope.exceptions import ForbiddenAttribute
+from zope.security.interfaces import ForbiddenAttribute
from zope.app import zapi
from zope.app.tests import ztapi
from zope.app.tests.placelesssetup import PlacelessSetup, setUp, tearDown
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -18,7 +18,7 @@
import unittest
from transaction import get_transaction
-from zope.exceptions import Unauthorized
+from zope.security.interfaces import Unauthorized
from zope.app.tests.functional import BrowserTestCase
from zope.app.file import File
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/debugskin/configure.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/debugskin/configure.zcml 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/debugskin/configure.zcml 2004-07-27 14:33:50 UTC (rev 26792)
@@ -6,7 +6,7 @@
<skin name="Debug" layers="debug rotterdam default" />
<page
- for="zope.exceptions.IUnauthorized"
+ for="zope.security.interfaces.IUnauthorized"
name="index.html"
permission="zope.Public"
template="unauthorized.pt"
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/exception/browser/configure.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/exception/browser/configure.zcml 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/exception/browser/configure.zcml 2004-07-27 14:33:50 UTC (rev 26792)
@@ -10,7 +10,7 @@
/>
<page
- for="zope.exceptions.IUnauthorized"
+ for="zope.security.interfaces.IUnauthorized"
name="index.html"
permission="zope.Public"
template="unauthorized.pt"
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/http/exception/configure.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/http/exception/configure.zcml 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/http/exception/configure.zcml 2004-07-27 14:33:50 UTC (rev 26792)
@@ -1,7 +1,7 @@
<configure xmlns="http://namespaces.zope.org/zope">
<view
- for="zope.exceptions.IUnauthorized"
+ for="zope.security.interfaces.IUnauthorized"
type="zope.publisher.interfaces.http.IHTTPRequest"
name="index.html"
permission="zope.Public"
@@ -9,7 +9,7 @@
/>
<defaultView
- for="zope.exceptions.IUnauthorized"
+ for="zope.security.interfaces.IUnauthorized"
type="zope.publisher.interfaces.http.IHTTPRequest"
name="index.html"
/>
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/talesapi.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -19,7 +19,7 @@
from zope.app.size.interfaces import ISized
from zope.app import zapi
from zope.interface import implements
-from zope.exceptions import Unauthorized
+from zope.security.interfaces import Unauthorized
from zope.tales.interfaces import ITALESFunctionNamespace
from interfaces import IZopeTalesAPI
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/tests/test_zopepythonexpr.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/tests/test_zopepythonexpr.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/pagetemplate/tests/test_zopepythonexpr.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -34,7 +34,7 @@
def test(self):
from zope.app.pagetemplate.engine import ZopePythonExpr
- from zope.exceptions import Forbidden
+ from zope.security.interfaces import Forbidden
expr = ZopePythonExpr('python', 'max(a,b)', Engine())
self.assertEqual(expr(Context(a=1, b=2)), 2)
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -20,7 +20,7 @@
from zope.app.tests import ztapi
from StringIO import StringIO
-from zope.exceptions import ForbiddenAttribute
+from zope.security.interfaces import ForbiddenAttribute
from zope.interface import Interface, implements
from zope.publisher.publish import publish
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -22,7 +22,7 @@
from ZODB.POSException import ConflictError
from zope.event import notify
-from zope.exceptions import Unauthorized
+from zope.security.interfaces import Unauthorized
from zope.component.exceptions import ComponentLookupError
from zope.interface import implements, providedBy
from zope.proxy import removeAllProxies
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/globalbrowsermenuservice.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/globalbrowsermenuservice.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/globalbrowsermenuservice.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -18,7 +18,8 @@
__metaclass__ = type
import sys
-from zope.exceptions import DuplicationError, Unauthorized, Forbidden
+from zope.exceptions import DuplicationError
+from zope.security.interfaces import Unauthorized, Forbidden
from zope.interface import implements, implementedBy
from zope.security.checker import CheckerPublic
from zope.security import checkPermission
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -16,7 +16,8 @@
$Id$
"""
import unittest
-from zope.exceptions import Forbidden, Unauthorized, DuplicationError
+from zope.exceptions import DuplicationError
+from zope.security.interfaces import Forbidden, Unauthorized
from zope.interface import Interface, implements
from zope.publisher.browser import TestRequest
from zope.publisher.interfaces.browser import IBrowserPublisher
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_icondirective.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_icondirective.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_icondirective.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -19,7 +19,7 @@
from StringIO import StringIO
from unittest import TestCase, main, makeSuite
-from zope.exceptions import Forbidden
+from zope.security.interfaces import Forbidden
from zope.proxy import removeAllProxies
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.configuration.xmlconfig import xmlconfig, XMLConfig
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_row.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_row.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_row.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -35,7 +35,7 @@
def test_RowClassFactory_Proxied(self):
from zope.app.rdb import RowClassFactory
from zope.security.proxy import ProxyFactory
- from zope.exceptions import ForbiddenAttribute
+ from zope.security.interfaces import ForbiddenAttribute
from zope.security.interfaces import IChecker
columns = ('type', 'speed')
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/tests/functional.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/tests/functional.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/tests/functional.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -30,7 +30,7 @@
from zope.publisher.browser import BrowserRequest
from zope.publisher.http import HTTPRequest
from zope.publisher.publish import publish
-from zope.exceptions import Forbidden, Unauthorized
+from zope.security.interfaces import Forbidden, Unauthorized
from zope.security.management import endInteraction
from zope.app.debug import Debugger
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test_decorator.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test_decorator.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test_decorator.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -22,7 +22,7 @@
from zope.interface import Interface, implements, directlyProvides, providedBy
from zope.interface import directlyProvidedBy, implementedBy
from zope.testing.doctestunit import DocTestSuite
-from zope.exceptions import ForbiddenAttribute
+from zope.security.interfaces import ForbiddenAttribute
class I1(Interface):
pass
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/tests/test_traverser.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/tests/test_traverser.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/tests/test_traverser.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -32,7 +32,8 @@
from zope.app.traversing.adapters import RootPhysicallyLocatable
from zope.app.container.contained import contained
-from zope.exceptions import NotFoundError, Unauthorized
+from zope.exceptions import NotFoundError
+from zope.security.interfaces import Unauthorized
from zope.app.servicenames import Adapters
from zope.app.site.tests.placefulsetup import PlacefulSetup
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/undo/browser.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/undo/browser.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/undo/browser.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -15,7 +15,7 @@
$Id$
"""
-from zope.exceptions import ForbiddenAttribute
+from zope.security.interfaces import ForbiddenAttribute
from zope.app import zapi
from zope.app.publisher.browser import BrowserView
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/tests/test_zptpage.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/tests/test_zptpage.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/tests/test_zptpage.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -19,7 +19,7 @@
import unittest
from zope.interface.verify import verifyClass
-from zope.exceptions import Forbidden
+from zope.security.interfaces import Forbidden
from zope.app.tests import ztapi
from zope.component import getView
Modified: Zope3/branches/ZopeX3-3.0/src/zope/exceptions/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/exceptions/__init__.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/exceptions/__init__.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -20,8 +20,18 @@
"""
from zope.exceptions._zope_error import ZopeError, IZopeError
-from zope.exceptions.unauthorized import Unauthorized, IUnauthorized
from zope.exceptions._notfounderror import NotFoundError, INotFoundError
-from zope.exceptions._forbidden import Forbidden, ForbiddenAttribute
-from zope.exceptions._forbidden import IForbidden, IForbiddenAttribute
from zope.exceptions._duplicate import DuplicationError, IDuplicationError
+
+# Importing these interfaces from here is deprecated!
+
+# avoid depency on zope.security:
+try:
+ import zope.security
+except ImportError, v:
+ if not str(v).endswith(' zope.security'):
+ raise
+else:
+ from zope.security.interfaces import IUnauthorized, Unauthorized
+ from zope.security.interfaces import IForbidden, IForbiddenAttribute
+ from zope.security.interfaces import Forbidden, ForbiddenAttribute
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/exceptions/_forbidden.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/exceptions/_forbidden.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/exceptions/_forbidden.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -1,37 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from zope.exceptions import ZopeError, IZopeError
-from zope.interface import implements
-from zope.interface.common.interfaces import IAttributeError
-
-class IForbidden(IZopeError):
- pass
-
-class Forbidden(ZopeError):
- """A resource cannot be accessed under any circumstances
- """
- implements(IForbidden)
-
-class IForbiddenAttribute(IForbidden, IAttributeError):
- pass
-
-class ForbiddenAttribute(Forbidden, AttributeError):
- """An attribute is unavailable because it is forbidden (private)
- """
- implements(IForbiddenAttribute)
-
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Unauthorized Exception definition
-
-$Id$
-"""
-from zope.exceptions import ZopeError
-from zope.exceptions import IZopeError
-from zope.interface import implements
-
-class IUnauthorized(IZopeError):
- pass
-
-class Unauthorized(ZopeError):
- """Some user wasn't allowed to access a resource"""
-
- implements(IUnauthorized)
-
- def __init__(self, name=None, permission=None):
- self.name, self.permission = name, permission
Modified: Zope3/branches/ZopeX3-3.0/src/zope/publisher/interfaces/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/publisher/interfaces/__init__.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/publisher/interfaces/__init__.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -18,7 +18,7 @@
from zope.interface import Interface
from zope.interface import Attribute
-from zope.exceptions import Unauthorized
+from zope.security.interfaces import Unauthorized
from zope.exceptions import NotFoundError, INotFoundError
from zope.component.interfaces import IPresentationRequest
from zope.interface import implements
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c 2004-07-27 14:33:50 UTC (rev 26792)
@@ -551,7 +551,7 @@
if (thread_local == NULL) return;
Py_DECREF(m);
- if ((m = PyImport_ImportModule("zope.exceptions")) == NULL) return;
+ if ((m = PyImport_ImportModule("zope.security.interfaces")) == NULL) return;
ForbiddenAttribute = PyObject_GetAttrString(m, "ForbiddenAttribute");
if (ForbiddenAttribute == NULL) return;
Unauthorized = PyObject_GetAttrString(m, "Unauthorized");
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -30,17 +30,19 @@
import types
import datetime
import weakref
+
+from zope.exceptions import DuplicationError
import zope.interface.interface
import zope.interface.interfaces
import zope.interface.declarations
-
from zope.interface import directlyProvides, Interface, implements
from zope.interface.interfaces import IInterface, IDeclaration
+
from zope.security.interfaces import IChecker, INameBasedChecker
from zope.security.interfaces import ISecurityProxyFactory
+from zope.security.interfaces import Unauthorized, ForbiddenAttribute
from zope.security.management import thread_local
from zope.security._proxy import _Proxy as Proxy, getChecker
-from zope.exceptions import Unauthorized, ForbiddenAttribute, DuplicationError
__metaclass__ = type
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/interfaces.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/interfaces.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/interfaces.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -15,9 +15,38 @@
$Id$
"""
-from zope.interface import Interface, Attribute
+from zope.exceptions import ZopeError
+from zope.exceptions import IZopeError
+from zope.interface import Interface, Attribute, implements
+from zope.interface.common.interfaces import IAttributeError
+class IUnauthorized(IZopeError):
+ pass
+
+class Unauthorized(ZopeError):
+ """Some user wasn't allowed to access a resource"""
+
+ implements(IUnauthorized)
+
+
+class IForbidden(IZopeError):
+ pass
+
+class Forbidden(ZopeError):
+ """A resource cannot be accessed under any circumstances
+ """
+ implements(IForbidden)
+
+class IForbiddenAttribute(IForbidden, IAttributeError):
+ pass
+
+class ForbiddenAttribute(Forbidden, AttributeError):
+ """An attribute is unavailable because it is forbidden (private)
+ """
+ implements(IForbiddenAttribute)
+
+
class ISecurityManagement(Interface):
"""Public security management API."""
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_builtins.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_builtins.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_builtins.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -23,7 +23,7 @@
def test(self):
from zope.security.builtins import RestrictedBuiltins
- from zope.exceptions import Forbidden
+ from zope.security.interfaces import Forbidden
def e(expr):
return eval(expr, {'__builtins__': RestrictedBuiltins})
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_checker.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_checker.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_checker.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -21,8 +21,10 @@
from zope.security.checker import Checker, NamesChecker, CheckerPublic
from zope.testing.cleanup import CleanUp
from zope.security.interfaces import ISecurityPolicy
-from zope.exceptions import Forbidden, Unauthorized, ForbiddenAttribute
-from zope.security.management import setSecurityPolicy, newInteraction, endInteraction, getInteraction
+from zope.security.interfaces import Forbidden, ForbiddenAttribute
+from zope.security.interfaces import Unauthorized
+from zope.security.management import setSecurityPolicy, newInteraction
+from zope.security.management import endInteraction, getInteraction
from zope.proxy import getProxiedObject
from zope.security.proxy import getChecker
from zope.security.checker import defineChecker, ProxyFactory
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_standard_checkers.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_standard_checkers.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_standard_checkers.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -20,7 +20,7 @@
"""
from zope.security.checker import ProxyFactory, NamesChecker
-from zope.exceptions import ForbiddenAttribute
+from zope.security.interfaces import ForbiddenAttribute
def check_forbidden_get(object, attr):
Modified: Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/server.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/server.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/server.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -21,7 +21,7 @@
from datetime import date, timedelta
from getopt import getopt, GetoptError
import asyncore
-from zope.exceptions import Unauthorized
+from zope.security.interfaces import Unauthorized
from zope.server.serverbase import ServerBase
from zope.server.interfaces.ftp import IFileSystemAccess
from zope.server.linereceiver.lineserverchannel import LineServerChannel
Modified: Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/demofs.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/demofs.py 2004-07-27 14:30:31 UTC (rev 26791)
+++ Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/demofs.py 2004-07-27 14:33:50 UTC (rev 26792)
@@ -16,7 +16,7 @@
__metaclass__ = type
import posixpath
-from zope.exceptions import Unauthorized
+from zope.security.interfaces import Unauthorized
from zope.server.interfaces.ftp import IFileSystem
from zope.server.interfaces.ftp import IFileSystemAccess
from zope.interface import implements
More information about the Zope3-Checkins
mailing list