Commit 301616ab authored by 's avatar

- updated imports

parent af8c23cf
......@@ -50,12 +50,12 @@ from webdav.Collection import Collection
from webdav.Lockable import ResourceLockedError
from webdav.NullResource import NullResource
from zExceptions import BadRequest
from zope.interface import implements
from zope.component.interfaces import ComponentLookupError
from zope.container.contained import notifyContainerModified
from zope.event import notify
from zope.interface import implements
from zope.interface.interfaces import ComponentLookupError
from zope.lifecycleevent import ObjectAddedEvent
from zope.lifecycleevent import ObjectRemovedEvent
from zope.container.contained import notifyContainerModified
from OFS.CopySupport import CopyContainer
from OFS.interfaces import IObjectManager
......
......@@ -16,11 +16,12 @@ OFS event definitions.
"""
from zope.interface import implements
from zope.component.interfaces import ObjectEvent
from zope.interface.interfaces import ObjectEvent
import OFS.interfaces
class ObjectWillBeMovedEvent(ObjectEvent):
"""An object will be moved."""
implements(OFS.interfaces.IObjectWillBeMovedEvent)
......@@ -31,7 +32,9 @@ class ObjectWillBeMovedEvent(ObjectEvent):
self.newParent = newParent
self.newName = newName
class ObjectWillBeAddedEvent(ObjectWillBeMovedEvent):
"""An object will be added to a container."""
implements(OFS.interfaces.IObjectWillBeAddedEvent)
......@@ -43,7 +46,9 @@ class ObjectWillBeAddedEvent(ObjectWillBeMovedEvent):
ObjectWillBeMovedEvent.__init__(self, object, None, None,
newParent, newName)
class ObjectWillBeRemovedEvent(ObjectWillBeMovedEvent):
"""An object will be removed from a container."""
implements(OFS.interfaces.IObjectWillBeRemovedEvent)
......@@ -55,6 +60,8 @@ class ObjectWillBeRemovedEvent(ObjectWillBeMovedEvent):
ObjectWillBeMovedEvent.__init__(self, object, oldParent, oldName,
None, None)
class ObjectClonedEvent(ObjectEvent):
"""An object has been cloned into a container."""
implements(OFS.interfaces.IObjectClonedEvent)
......@@ -17,6 +17,7 @@ from zope.component.interfaces import IPossibleSite
from zope.container.interfaces import IContainer
from zope.interface import Attribute
from zope.interface import Interface
from zope.interface.interfaces import IObjectEvent
from zope.location.interfaces import IRoot
from zope.schema import Bool, BytesLine, Tuple
......@@ -871,8 +872,6 @@ class IApplication(IFolder, IRoot):
##################################################
# Event interfaces
from zope.component.interfaces import IObjectEvent
class IObjectWillBeMovedEvent(IObjectEvent):
"""An object will be moved."""
oldParent = Attribute("The old location parent for the object.")
......@@ -880,12 +879,15 @@ class IObjectWillBeMovedEvent(IObjectEvent):
newParent = Attribute("The new location parent for the object.")
newName = Attribute("The new location name for the object.")
class IObjectWillBeAddedEvent(IObjectWillBeMovedEvent):
"""An object will be added to a container."""
class IObjectWillBeRemovedEvent(IObjectWillBeMovedEvent):
"""An object will be removed from a container"""
class IObjectClonedEvent(IObjectEvent):
"""An object has been cloned (a la Zope 2).
......
......@@ -51,12 +51,13 @@ not for (None, IObjectEvent), and register our subscribers before the
framework's ones, so ours will be called first. This has the effect that
printed events will be in their "natural" order::
>>> from zope.component.interfaces import IObjectEvent, IRegistrationEvent
>>> from zope.lifecycleevent.interfaces import IObjectMovedEvent
>>> from zope.interface.interfaces import IObjectEvent
>>> from zope.interface.interfaces import IRegistrationEvent
>>> from zope.lifecycleevent.interfaces import IObjectCopiedEvent
>>> from OFS.interfaces import IObjectWillBeMovedEvent
>>> from OFS.interfaces import IObjectClonedEvent
>>> from zope.lifecycleevent.interfaces import IObjectMovedEvent
>>> from OFS.interfaces import IItem
>>> from OFS.interfaces import IObjectClonedEvent
>>> from OFS.interfaces import IObjectWillBeMovedEvent
>>> def printObjectEvent(object, event):
... print event.__class__.__name__, object.getId()
>>> def printObjectEventExceptSome(object, event):
......
......@@ -5,22 +5,18 @@ Zope2.startup()
import transaction
from Testing.makerequest import makerequest
from zope import component
from zope import interface
from zope.interface.interfaces import IObjectEvent
from zope.testing import cleanup
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from OFS.SimpleItem import SimpleItem
from OFS.Folder import Folder
from OFS.SimpleItem import SimpleItem
from Testing.makerequest import makerequest
from Zope2.App import zcml
from zope import interface
from zope import component
from zope.component.interfaces import IObjectEvent
from zope.testing import cleanup
class EventLogger(object):
def __init__(self):
......@@ -38,6 +34,7 @@ eventlog = EventLogger()
class ITestItem(interface.Interface):
pass
class TestItem(SimpleItem):
interface.implements(ITestItem)
def __init__(self, id):
......@@ -47,6 +44,7 @@ class TestItem(SimpleItem):
class ITestFolder(interface.Interface):
pass
class TestFolder(Folder):
interface.implements(ITestFolder)
def __init__(self, id):
......@@ -330,4 +328,3 @@ def test_suite():
suite.addTest(makeSuite(TestCopySupport))
suite.addTest(makeSuite(TestCopySupportSublocation))
return suite
import unittest
class ViewPageTemplateFileTests(unittest.TestCase):
def setUp(self):
......@@ -192,7 +193,7 @@ class ViewMapperTests(unittest.TestCase):
return self._getTargetClass()(ob, request)
def test___getitem___miss(self):
from zope.component import ComponentLookupError
from zope.interface.interfaces import ComponentLookupError
mapper = self._makeOne()
self.assertRaises(ComponentLookupError, mapper.__getitem__, 'nonesuch')
......
......@@ -17,9 +17,9 @@
import zope.component
import zope.event
import zope.interface
from zope.component.interfaces import IComponentLookup
from zope.component.interfaces import IPossibleSite
from zope.component.interfaces import ISite
from zope.interface.interfaces import IComponentLookup
from zope.traversing.interfaces import BeforeTraverseEvent
import ExtensionClass
......@@ -64,7 +64,7 @@ def enableSite(obj, iface=ISite):
# We want the original object, not stuff in between, and no acquisition
obj = aq_base(obj)
if not IPossibleSite.providedBy(obj):
raise TypeError, 'Must provide IPossibleSite'
raise TypeError('Must provide IPossibleSite')
hook = NameCaller(HOOK_NAME)
registerBeforeTraverse(obj, hook, HOOK_NAME, 1)
......
......@@ -30,7 +30,7 @@ Now we create a site object with a stub component registry:
When we adapt the site itself, we obviously get its component
registry:
>>> from zope.component.interfaces import IComponentLookup
>>> from zope.interface.interfaces import IComponentLookup
>>> IComponentLookup(site) is components
True
......
......@@ -56,7 +56,7 @@ We get the site manager for the folder and assert that it is indeed a
component registry:
>>> sm = app.folder.getSiteManager()
>>> from zope.component.interfaces import IComponents
>>> from zope.interface.interfaces import IComponents
>>> IComponents.providedBy(sm)
True
......
......@@ -27,7 +27,7 @@ class ViewletManagerBase(origManagerBase):
"""A base class for Viewlet managers to work in Zope2"""
template = None
def __getitem__(self, name):
"""See zope.interface.common.mapping.IReadMapping"""
# Find the viewlet
......@@ -37,7 +37,7 @@ class ViewletManagerBase(origManagerBase):
# If the viewlet was not found, then raise a lookup error
if viewlet is None:
raise zope.component.interfaces.ComponentLookupError(
raise zope.interface.interfaces.ComponentLookupError(
'No provider with name `%s` found.' %name)
# If the viewlet cannot be accessed, then raise an
......@@ -77,7 +77,7 @@ class ViewletManagerBase(origManagerBase):
def ViewletManager(name, interface, template=None, bases=()):
attrDict = {'__name__': name}
if template is not None:
attrDict['template'] = ZopeTwoPageTemplateFile(template)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment