Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
301616ab
Commit
301616ab
authored
Jul 18, 2012
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- updated imports
parent
af8c23cf
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
37 additions
and
29 deletions
+37
-29
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+3
-3
src/OFS/event.py
src/OFS/event.py
+8
-1
src/OFS/interfaces.py
src/OFS/interfaces.py
+4
-2
src/OFS/tests/event.txt
src/OFS/tests/event.txt
+5
-4
src/OFS/tests/testCopySupportEvents.py
src/OFS/tests/testCopySupportEvents.py
+8
-11
src/Products/Five/browser/tests/test_pagetemplatefile.py
src/Products/Five/browser/tests/test_pagetemplatefile.py
+2
-1
src/Products/Five/component/__init__.py
src/Products/Five/component/__init__.py
+2
-2
src/Products/Five/component/component.txt
src/Products/Five/component/component.txt
+1
-1
src/Products/Five/component/makesite.txt
src/Products/Five/component/makesite.txt
+1
-1
src/Products/Five/viewlet/manager.py
src/Products/Five/viewlet/manager.py
+3
-3
No files found.
src/OFS/ObjectManager.py
View file @
301616ab
...
...
@@ -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
...
...
src/OFS/event.py
View file @
301616ab
...
...
@@ -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
)
src/OFS/interfaces.py
View file @
301616ab
...
...
@@ -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).
...
...
src/OFS/tests/event.txt
View file @
301616ab
...
...
@@ -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, IRegistration
Event
>>> from zope.
lifecycleevent.interfaces import IObjectMoved
Event
>>> from zope.
interface.interfaces import IObject
Event
>>> from zope.
interface.interfaces import IRegistration
Event
>>> 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):
...
...
src/OFS/tests/testCopySupportEvents.py
View file @
301616ab
...
...
@@ -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
src/Products/Five/browser/tests/test_pagetemplatefile.py
View file @
301616ab
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'
)
...
...
src/Products/Five/component/__init__.py
View file @
301616ab
...
...
@@ -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
)
...
...
src/Products/Five/component/component.txt
View file @
301616ab
...
...
@@ -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
...
...
src/Products/Five/component/makesite.txt
View file @
301616ab
...
...
@@ -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
...
...
src/Products/Five/viewlet/manager.py
View file @
301616ab
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment