Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
ed7734d0
Commit
ed7734d0
authored
Nov 18, 2011
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oops, forgot to check these in when removing the dependency on zope.event
parent
4f75ec10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
src/ZODB/event.py
src/ZODB/event.py
+65
-0
src/ZODB/event.txt
src/ZODB/event.txt
+10
-0
No files found.
src/ZODB/event.py
0 → 100644
View file @
ed7734d0
##############################################################################
#
# Copyright Zope Foundation 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.
#
##############################################################################
def
_noop
(
event
):
"""
Tests:
>>> import sys, ZODB.event
>>> notify = ZODB.event
>>> zopemod = sys.modules.get('zope', False)
>>> event = sys.modules.get('zope.event', False)
>>> if event:
... del zopemod.event
... sys.modules['zope.event'] = None
... _ = reload(ZODB.event)
If zope.event isn't installed, then notify is _noop
>>> ZODB.event.notify is ZODB.event._noop
True
If zope.event is installed, then notify is zope.event.notify:
>>> zope = sys.modules['zope'] = type(sys)('zope')
>>> zope.event = sys.modules['zope.event'] = type(sys)('zope.event')
>>> zope.event.notify = lambda e: None
>>> _ = reload(ZODB.event)
>>> ZODB.event.notify is zope.event.notify
True
Cleanup:
>>> if event is False:
... del sys.modules['zope.event']
... else:
... if event:
... zopemod.event = event
... sys.modules['zope.event'] = event
>>> if zopemod is False:
... del sys.modules['zope']
... else:
... sys.modules['zope'] = zopemod
>>> ZODB.event.notify = notify
"""
pass
try
:
from
zope.event
import
notify
except
ImportError
:
notify
=
_noop
src/ZODB/event.txt
0 → 100644
View file @
ed7734d0
Event support
Sometimes, you want to react when ZODB does certain things. In the
past, ZODB provided ad hoc hook functions for this. Going forward,
ZODB will use an event mechanism. ZODB.event.notify is called with
events of interest.
If zope.event is installed, then ZODB.event.notify is simply an alias
for zope.event. If zope.event isn't installed, then ZODB.event is a
noop.
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