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
ebdc1cd7
Commit
ebdc1cd7
authored
Apr 05, 2007
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure subscribers in code, not by loading ZCML.
parent
7a063a5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
119 deletions
+23
-119
lib/python/OFS/tests/events.zcml
lib/python/OFS/tests/events.zcml
+0
-112
lib/python/OFS/tests/testCopySupportEvents.py
lib/python/OFS/tests/testCopySupportEvents.py
+23
-7
No files found.
lib/python/OFS/tests/events.zcml
deleted
100644 → 0
View file @
7a063a5e
<configure
xmlns="http://namespaces.zope.org/zope"
i18n_domain="extfile">
<!-- Item -->
<subscriber
handler=".testCopySupportEvents.objectAddedEvent"
for=".testCopySupportEvents.ITestItem
zope.app.container.interfaces.IObjectAddedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectCopiedEvent"
for=".testCopySupportEvents.ITestItem
zope.lifecycleevent.interfaces.IObjectCopiedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectMovedEvent"
for=".testCopySupportEvents.ITestItem
zope.app.container.interfaces.IObjectMovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectRemovedEvent"
for=".testCopySupportEvents.ITestItem
zope.app.container.interfaces.IObjectRemovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectWillBeAddedEvent"
for=".testCopySupportEvents.ITestItem
OFS.interfaces.IObjectWillBeAddedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectWillBeMovedEvent"
for=".testCopySupportEvents.ITestItem
OFS.interfaces.IObjectWillBeMovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectWillBeRemovedEvent"
for=".testCopySupportEvents.ITestItem
OFS.interfaces.IObjectWillBeRemovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectClonedEvent"
for=".testCopySupportEvents.ITestItem
OFS.interfaces.IObjectClonedEvent"
/>
<!-- Folder -->
<subscriber
handler=".testCopySupportEvents.objectAddedEvent"
for=".testCopySupportEvents.ITestFolder
zope.app.container.interfaces.IObjectAddedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectCopiedEvent"
for=".testCopySupportEvents.ITestFolder
zope.lifecycleevent.interfaces.IObjectCopiedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectMovedEvent"
for=".testCopySupportEvents.ITestFolder
zope.app.container.interfaces.IObjectMovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectRemovedEvent"
for=".testCopySupportEvents.ITestFolder
zope.app.container.interfaces.IObjectRemovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.containerModifiedEvent"
for=".testCopySupportEvents.ITestFolder
zope.app.container.interfaces.IContainerModifiedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectWillBeAddedEvent"
for=".testCopySupportEvents.ITestFolder
OFS.interfaces.IObjectWillBeAddedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectWillBeMovedEvent"
for=".testCopySupportEvents.ITestFolder
OFS.interfaces.IObjectWillBeMovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectWillBeRemovedEvent"
for=".testCopySupportEvents.ITestFolder
OFS.interfaces.IObjectWillBeRemovedEvent"
/>
<subscriber
handler=".testCopySupportEvents.objectClonedEvent"
for=".testCopySupportEvents.ITestFolder
OFS.interfaces.IObjectClonedEvent"
/>
</configure>
lib/python/OFS/tests/testCopySupportEvents.py
View file @
ebdc1cd7
...
...
@@ -3,7 +3,6 @@ import Testing
import
Zope2
Zope2
.
startup
()
import
os
import
transaction
from
Testing.makerequest
import
makerequest
...
...
@@ -15,14 +14,19 @@ from OFS.SimpleItem import SimpleItem
from
OFS.Folder
import
Folder
from
zope
import
interface
from
zope
import
component
from
zope.app.container.interfaces
import
IObjectAddedEvent
from
zope.app.container.interfaces
import
IObjectMovedEvent
from
zope.app.container.interfaces
import
IObjectRemovedEvent
from
zope.app.container.interfaces
import
IContainerModifiedEvent
from
zope.lifecycleevent.interfaces
import
IObjectCopiedEvent
from
OFS.interfaces
import
IObjectWillBeAddedEvent
from
OFS.interfaces
import
IObjectWillBeMovedEvent
from
OFS.interfaces
import
IObjectWillBeRemovedEvent
from
OFS.interfaces
import
IObjectClonedEvent
from
zope.testing
import
cleanup
from
Products.Five
import
zcml
from
Globals
import
package_home
class
EventLogger
(
object
):
...
...
@@ -58,8 +62,6 @@ class TestFolder(Folder):
pass
# Always allow
# See events.zcml
def
objectAddedEvent
(
ob
,
event
):
eventlog
.
trace
(
ob
,
'ObjectAddedEvent'
)
...
...
@@ -96,6 +98,21 @@ def objectClonedEvent(ob, event):
eventlog
.
trace
(
ob
,
'ObjectClonedEvent'
)
def
setUpItemSubscribers
(
interface
):
component
.
provideHandler
(
objectAddedEvent
,
(
interface
,
IObjectAddedEvent
))
component
.
provideHandler
(
objectCopiedEvent
,
(
interface
,
IObjectCopiedEvent
))
component
.
provideHandler
(
objectMovedEvent
,
(
interface
,
IObjectMovedEvent
))
component
.
provideHandler
(
objectRemovedEvent
,
(
interface
,
IObjectRemovedEvent
))
component
.
provideHandler
(
objectWillBeAddedEvent
,
(
interface
,
IObjectWillBeAddedEvent
))
component
.
provideHandler
(
objectWillBeMovedEvent
,
(
interface
,
IObjectWillBeMovedEvent
))
component
.
provideHandler
(
objectWillBeRemovedEvent
,
(
interface
,
IObjectWillBeRemovedEvent
))
component
.
provideHandler
(
objectClonedEvent
,
(
interface
,
IObjectClonedEvent
))
def
setUpFolderSubscribers
(
interface
):
setUpItemSubscribers
(
interface
)
component
.
provideHandler
(
containerModifiedEvent
,
(
interface
,
IContainerModifiedEvent
))
class
EventLayer
:
@
classmethod
...
...
@@ -103,9 +120,8 @@ class EventLayer:
cleanup
.
cleanUp
()
zcml
.
_initialized
=
0
zcml
.
load_site
()
import
OFS.tests
file
=
os
.
path
.
join
(
package_home
(
globals
()),
'events.zcml'
)
zcml
.
load_config
(
file
,
package
=
OFS
.
tests
)
setUpItemSubscribers
(
ITestItem
)
setUpFolderSubscribers
(
ITestFolder
)
@
classmethod
def
tearDown
(
cls
):
...
...
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