zope.event-4.2.0/ 0000775 0001750 0001750 00000000000 12661103467 014766 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/setup.cfg 0000664 0001750 0001750 00000000453 12661103467 016611 0 ustar tseaver tseaver 0000000 0000000 [nosetests]
nocapture = 1
cover-package = zope.event
cover-erase = 1
cover-branches = 1
cover-min-percentage = 100
with-doctest = 0
where = src
[aliases]
dev = develop easy_install zope.event[testing]
docs = easy_install zope.event[docs]
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
zope.event-4.2.0/buildout.cfg 0000664 0001750 0001750 00000000140 12450532135 017263 0 ustar tseaver tseaver 0000000 0000000 [buildout]
develop = .
parts =
test
[test]
recipe = zc.recipe.testrunner
eggs = zope.event
zope.event-4.2.0/PKG-INFO 0000664 0001750 0001750 00000010663 12661103467 016071 0 ustar tseaver tseaver 0000000 0000000 Metadata-Version: 1.1
Name: zope.event
Version: 4.2.0
Summary: Very basic event publishing system
Home-page: http://pypi.python.org/pypi/zope.event
Author: Zope Foundation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: ``zope.event`` README
=====================
.. image:: https://img.shields.io/pypi/v/zope.event.svg
:target: https://pypi.python.org/pypi/zope.event/
:alt: Latest Version
.. image:: https://travis-ci.org/zopefoundation/zope.event.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.event
.. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest
:target: http://zopeevent.readthedocs.org/en/latest/
:alt: Documentation Status
The ``zope.event`` package provides a simple event system, including:
- An event publishing API, intended for use by applications which are
unaware of any subscribers to their events.
- A very simple event-dispatching system on which more sophisticated
event dispatching systems can be built. For example, a type-based
event dispatching system that builds on ``zope.event`` can be found in
``zope.component``.
Please see http://zopeevent.rtfd.org/ for the documentation.
``zope.event`` Changelog
========================
4.2.0 (2016-02-17)
------------------
- Add support for Python 3.5.
- Drop support for Python 2.6 and 3.2.
4.1.0 (2015-10-18)
------------------
- Require 100% branch (as well as statement) coverage.
- Add a simple class-based handler implementation.
4.0.3 (2014-03-19)
------------------
- Add support for Python 3.4.
- Update ``boostrap.py`` to version 2.2.
4.0.2 (2012-12-31)
------------------
- Flesh out PyPI Trove classifiers.
- Add support for jython 2.7.
4.0.1 (2012-11-21)
------------------
- Add support for Python 3.3.
4.0.0 (2012-05-16)
------------------
- Automate build of Sphinx HTML docs and running doctest snippets via tox.
- Drop explicit support for Python 2.4 / 2.5 / 3.1.
- Add support for PyPy.
3.5.2 (2012-03-30)
------------------
- This release is the last which will maintain support for Python 2.4 /
Python 2.5.
- Add support for continuous integration using ``tox`` and ``jenkins``.
- Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs
``nose`` and ``coverage``).
- Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies).
3.5.1 (2011-08-04)
------------------
- Add Sphinx documentation.
3.5.0 (2010-05-01)
------------------
- Add change log to ``long-description``.
- Add support for Python 3.x.
3.4.1 (2009-03-03)
------------------
- A few minor cleanups.
3.4.0 (2007-07-14)
------------------
- Initial release as a separate project.
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: Jython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: Zope3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
zope.event-4.2.0/tox.ini 0000664 0001750 0001750 00000001303 12661102002 016256 0 ustar tseaver tseaver 0000000 0000000 [tox]
envlist =
# Jython 2.7b1 support pending fix for Jython incompat. w/ pip's vendored-in
# requests -> html5 libraries. See
# https://github.com/html5lib/html5lib-python/pull/150
# py27,py33,py34,pypy,pypy3,jython,coverage,docs
py27,py33,py34,py35,pypy,pypy3,coverage,docs
[testenv]
commands =
python setup.py -q test -q
[testenv:coverage]
basepython =
python2.7
commands =
nosetests --with-xunit --with-xcoverage
deps =
nose
coverage
nosexcover
[testenv:docs]
basepython =
python2.7
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
deps =
Sphinx
zope.event-4.2.0/.gitignore 0000664 0001750 0001750 00000000304 12450532135 016745 0 ustar tseaver tseaver 0000000 0000000 *$py.class
*.pyc
__pycache__
./.installed.cfg
./bin
./eggs
./develop-eggs
./parts
*.egg-info
.tox
build
docs/_build
.coverage
nosetests.xml
coverage.xml
.installed.cfg
bin
develop-eggs
eggs
parts
zope.event-4.2.0/setup.py 0000664 0001750 0001750 00000005261 12661103400 016467 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
# This package is developed by the Zope Toolkit project, documented here:
# http://docs.zope.org/zopetoolkit
# When developing and releasing this package, please follow the documented
# Zope Toolkit policies as described by this documentation.
##############################################################################
"""Setup for zope.event package
"""
import os
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name='zope.event',
version='4.2.0',
url='http://pypi.python.org/pypi/zope.event',
license='ZPL 2.1',
description='Very basic event publishing system',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
long_description=(
read('README.rst')
+ '\n' +
read('CHANGES.rst')
),
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Zope Public License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: Jython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Zope3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope',],
include_package_data=True,
install_requires=['setuptools'],
zip_safe=False,
test_suite='zope.event.tests.test_suite',
extras_require={'docs': ['Sphinx'],
'testing': ['nose', 'coverage'],
},
)
zope.event-4.2.0/bootstrap.py 0000664 0001750 0001750 00000014545 12450532135 017360 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import os
import shutil
import sys
import tempfile
from optparse import OptionParser
tmpeggs = tempfile.mkdtemp()
usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
Bootstraps a buildout-based project.
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.
Note that by using --find-links to point to local resources, you can keep
this script from going over the network.
'''
parser = OptionParser(usage=usage)
parser.add_option("-v", "--version", help="use a specific zc.buildout version")
parser.add_option("-t", "--accept-buildout-test-releases",
dest='accept_buildout_test_releases',
action="store_true", default=False,
help=("Normally, if you do not specify a --version, the "
"bootstrap script and buildout gets the newest "
"*final* versions of zc.buildout and its recipes and "
"extensions for you. If you use this flag, "
"bootstrap and buildout will get the newest releases "
"even if they are alphas or betas."))
parser.add_option("-c", "--config-file",
help=("Specify the path to the buildout configuration "
"file to be used."))
parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")
options, args = parser.parse_args()
######################################################################
# load/install setuptools
try:
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
setup_args = dict(to_dir=tmpeggs, download_delay=0)
if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)
######################################################################
# Install buildout
ws = pkg_resources.working_set
cmd = [sys.executable, '-c',
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]
find_links = os.environ.get(
'bootstrap-testing-find-links',
options.find_links or
('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None)
)
if find_links:
cmd.extend(['-f', find_links])
setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location
requirement = 'zc.buildout'
version = options.version
if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout.
import setuptools.package_index
_final_parts = '*final-', '*final'
def _final_version(parsed_version):
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True
index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
index.add_find_links((find_links,))
req = pkg_resources.Requirement.parse(requirement)
if index.obtain(req) is not None:
best = []
bestv = None
for dist in index[req.project_name]:
distv = dist.parsed_version
if _final_version(distv):
if bestv is None or distv > bestv:
best = [dist]
bestv = distv
elif distv == bestv:
best.append(dist)
if best:
best.sort()
version = best[-1].version
if version:
requirement = '=='.join((requirement, version))
cmd.append(requirement)
import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])
######################################################################
# Import and run buildout
ws.add_entry(tmpeggs)
ws.require(requirement)
import zc.buildout.buildout
if not [a for a in args if '=' not in a]:
args.append('bootstrap')
# if -c was provided, we push it back into args for buildout' main function
if options.config_file is not None:
args[0:0] = ['-c', options.config_file]
zc.buildout.buildout.main(args)
shutil.rmtree(tmpeggs)
zope.event-4.2.0/.travis.yml 0000664 0001750 0001750 00000000312 12661102024 017057 0 ustar tseaver tseaver 0000000 0000000 language: python
sudo: false
python:
- 2.7
- 3.3
- 3.4
- 3.5
- pypy
- pypy3
install:
- pip install .
script:
- python setup.py -q test -q
notifications:
email: false
zope.event-4.2.0/src/ 0000775 0001750 0001750 00000000000 12661103467 015555 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/src/zope.event.egg-info/ 0000775 0001750 0001750 00000000000 12661103467 021344 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/src/zope.event.egg-info/top_level.txt 0000664 0001750 0001750 00000000005 12661103467 024071 0 ustar tseaver tseaver 0000000 0000000 zope
zope.event-4.2.0/src/zope.event.egg-info/SOURCES.txt 0000664 0001750 0001750 00000004546 12661103467 023241 0 ustar tseaver tseaver 0000000 0000000 .gitignore
.travis.yml
CHANGES.rst
COPYRIGHT.txt
LICENSE.txt
MANIFEST.in
README.rst
bootstrap.py
buildout.cfg
setup.cfg
setup.py
tox.ini
docs/Makefile
docs/api.rst
docs/classhandler.rst
docs/conf.py
docs/hacking.rst
docs/index.rst
docs/make.bat
docs/theory.rst
docs/usage.rst
docs/_build/doctest/output.txt
docs/_build/doctrees/api.doctree
docs/_build/doctrees/classhandler.doctree
docs/_build/doctrees/environment.pickle
docs/_build/doctrees/hacking.doctree
docs/_build/doctrees/index.doctree
docs/_build/doctrees/theory.doctree
docs/_build/doctrees/usage.doctree
docs/_build/html/.buildinfo
docs/_build/html/api.html
docs/_build/html/classhandler.html
docs/_build/html/genindex.html
docs/_build/html/hacking.html
docs/_build/html/index.html
docs/_build/html/objects.inv
docs/_build/html/search.html
docs/_build/html/searchindex.js
docs/_build/html/theory.html
docs/_build/html/usage.html
docs/_build/html/_sources/api.txt
docs/_build/html/_sources/classhandler.txt
docs/_build/html/_sources/hacking.txt
docs/_build/html/_sources/index.txt
docs/_build/html/_sources/theory.txt
docs/_build/html/_sources/usage.txt
docs/_build/html/_static/ajax-loader.gif
docs/_build/html/_static/basic.css
docs/_build/html/_static/classic.css
docs/_build/html/_static/comment-bright.png
docs/_build/html/_static/comment-close.png
docs/_build/html/_static/comment.png
docs/_build/html/_static/default.css
docs/_build/html/_static/doctools.js
docs/_build/html/_static/down-pressed.png
docs/_build/html/_static/down.png
docs/_build/html/_static/file.png
docs/_build/html/_static/jquery-1.11.1.js
docs/_build/html/_static/jquery.js
docs/_build/html/_static/minus.png
docs/_build/html/_static/plus.png
docs/_build/html/_static/pygments.css
docs/_build/html/_static/searchtools.js
docs/_build/html/_static/sidebar.js
docs/_build/html/_static/underscore-1.3.1.js
docs/_build/html/_static/underscore.js
docs/_build/html/_static/up-pressed.png
docs/_build/html/_static/up.png
docs/_build/html/_static/websupport.js
docs/_static/.gitignore
src/coverage.xml
src/zope/__init__.py
src/zope.event.egg-info/PKG-INFO
src/zope.event.egg-info/SOURCES.txt
src/zope.event.egg-info/dependency_links.txt
src/zope.event.egg-info/namespace_packages.txt
src/zope.event.egg-info/not-zip-safe
src/zope.event.egg-info/requires.txt
src/zope.event.egg-info/top_level.txt
src/zope/event/__init__.py
src/zope/event/classhandler.py
src/zope/event/tests.py zope.event-4.2.0/src/zope.event.egg-info/PKG-INFO 0000664 0001750 0001750 00000010663 12661103467 022447 0 ustar tseaver tseaver 0000000 0000000 Metadata-Version: 1.1
Name: zope.event
Version: 4.2.0
Summary: Very basic event publishing system
Home-page: http://pypi.python.org/pypi/zope.event
Author: Zope Foundation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: ``zope.event`` README
=====================
.. image:: https://img.shields.io/pypi/v/zope.event.svg
:target: https://pypi.python.org/pypi/zope.event/
:alt: Latest Version
.. image:: https://travis-ci.org/zopefoundation/zope.event.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.event
.. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest
:target: http://zopeevent.readthedocs.org/en/latest/
:alt: Documentation Status
The ``zope.event`` package provides a simple event system, including:
- An event publishing API, intended for use by applications which are
unaware of any subscribers to their events.
- A very simple event-dispatching system on which more sophisticated
event dispatching systems can be built. For example, a type-based
event dispatching system that builds on ``zope.event`` can be found in
``zope.component``.
Please see http://zopeevent.rtfd.org/ for the documentation.
``zope.event`` Changelog
========================
4.2.0 (2016-02-17)
------------------
- Add support for Python 3.5.
- Drop support for Python 2.6 and 3.2.
4.1.0 (2015-10-18)
------------------
- Require 100% branch (as well as statement) coverage.
- Add a simple class-based handler implementation.
4.0.3 (2014-03-19)
------------------
- Add support for Python 3.4.
- Update ``boostrap.py`` to version 2.2.
4.0.2 (2012-12-31)
------------------
- Flesh out PyPI Trove classifiers.
- Add support for jython 2.7.
4.0.1 (2012-11-21)
------------------
- Add support for Python 3.3.
4.0.0 (2012-05-16)
------------------
- Automate build of Sphinx HTML docs and running doctest snippets via tox.
- Drop explicit support for Python 2.4 / 2.5 / 3.1.
- Add support for PyPy.
3.5.2 (2012-03-30)
------------------
- This release is the last which will maintain support for Python 2.4 /
Python 2.5.
- Add support for continuous integration using ``tox`` and ``jenkins``.
- Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs
``nose`` and ``coverage``).
- Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies).
3.5.1 (2011-08-04)
------------------
- Add Sphinx documentation.
3.5.0 (2010-05-01)
------------------
- Add change log to ``long-description``.
- Add support for Python 3.x.
3.4.1 (2009-03-03)
------------------
- A few minor cleanups.
3.4.0 (2007-07-14)
------------------
- Initial release as a separate project.
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: Jython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: Zope3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
zope.event-4.2.0/src/zope.event.egg-info/dependency_links.txt 0000664 0001750 0001750 00000000001 12661103467 025412 0 ustar tseaver tseaver 0000000 0000000
zope.event-4.2.0/src/zope.event.egg-info/not-zip-safe 0000664 0001750 0001750 00000000001 12450532157 023570 0 ustar tseaver tseaver 0000000 0000000
zope.event-4.2.0/src/zope.event.egg-info/namespace_packages.txt 0000664 0001750 0001750 00000000005 12661103467 025672 0 ustar tseaver tseaver 0000000 0000000 zope
zope.event-4.2.0/src/zope.event.egg-info/requires.txt 0000664 0001750 0001750 00000000063 12661103467 023743 0 ustar tseaver tseaver 0000000 0000000 setuptools
[docs]
Sphinx
[testing]
nose
coverage
zope.event-4.2.0/src/coverage.xml 0000664 0001750 0001750 00000003741 12661102105 020063 0 ustar tseaver tseaver 0000000 0000000
/home/tseaver/projects/Zope/Z3/zopetoolkit/src/zope.event
zope.event-4.2.0/src/zope/ 0000775 0001750 0001750 00000000000 12661103467 016532 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/src/zope/__init__.py 0000664 0001750 0001750 00000000070 12450532135 020632 0 ustar tseaver tseaver 0000000 0000000 __import__('pkg_resources').declare_namespace(__name__)
zope.event-4.2.0/src/zope/event/ 0000775 0001750 0001750 00000000000 12661103467 017653 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/src/zope/event/__init__.py 0000664 0001750 0001750 00000002107 12450532135 021756 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
""" Base event system implementation
"""
#: Applications may register for notification of events by appending a
#: callable to the ``subscribers`` list.
#:
#: Each subscriber takes a single argument, which is the event object
#: being published.
#:
#: Exceptions raised by subscribers will be propagated.
subscribers = []
def notify(event):
""" Notify all subscribers of ``event``.
"""
for subscriber in subscribers:
subscriber(event)
zope.event-4.2.0/src/zope/event/tests.py 0000664 0001750 0001750 00000003470 12661101450 021361 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
""" Test the event system
"""
import doctest
import unittest
class Test_notify(unittest.TestCase):
def setUp(self):
from zope.event import subscribers
self._old_subscribers = subscribers[:]
subscribers[:] = []
def tearDown(self):
from zope.event import subscribers
subscribers[:] = self._old_subscribers
def _callFUT(self, event):
from zope.event import notify
notify(event)
def test_empty(self):
event = object()
self._callFUT(event)
def test_not_empty(self):
from zope.event import subscribers
dummy = []
subscribers.append(dummy.append)
event = object()
self._callFUT(event)
self.assertEqual(dummy, [event])
def setUpClassHandlers(test):
import zope.event
test.globs['old_subs'] = zope.event.subscribers
def tearDownClassHandlers(test):
import zope.event
zope.event.subscribers = test.globs['old_subs']
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(Test_notify),
doctest.DocTestSuite(
'zope.event.classhandler',
setUp=setUpClassHandlers, tearDown=tearDownClassHandlers)
))
zope.event-4.2.0/src/zope/event/classhandler.py 0000664 0001750 0001750 00000003367 12661101450 022667 0 ustar tseaver tseaver 0000000 0000000 """Class-based event handlers
A light-weight event-handler framework based on event classes.
Handlers are registered for event classes:
>>> import zope.event.classhandler
>>> class MyEvent(object):
... def __repr__(self):
... return self.__class__.__name__
>>> def handler1(event):
... print("handler1 %r" % event)
>>> zope.event.classhandler.handler(MyEvent, handler1)
Descriptor syntax:
>>> @zope.event.classhandler.handler(MyEvent)
... def handler2(event):
... print("handler2 %r" % event)
>>> class MySubEvent(MyEvent):
... pass
>>> @zope.event.classhandler.handler(MySubEvent)
... def handler3(event):
... print("handler3 %r" % event)
Subscribers are called in class method-resolution order, so only
new-style event classes are supported, and then by order of registry.
>>> import zope.event
>>> zope.event.notify(MySubEvent())
handler3 MySubEvent
handler1 MySubEvent
handler2 MySubEvent
"""
import zope.event
registry = {}
def handler(event_class, handler_=None, decorator=False):
"""Define an event handler for a (new-style) class.
This can be called with a class and a handler, or with just a
class and the result used as a handler decorator.
"""
if handler_ is None:
return lambda func: handler(event_class, func, True)
if not registry:
zope.event.subscribers.append(dispatch)
if event_class not in registry:
registry[event_class] = [handler_]
else:
registry[event_class].append(handler_)
if decorator:
return handler
def dispatch(event):
for event_class in event.__class__.__mro__:
for handler in registry.get(event_class, ()):
handler(event)
zope.event-4.2.0/COPYRIGHT.txt 0000664 0001750 0001750 00000000040 12450532135 017063 0 ustar tseaver tseaver 0000000 0000000 Zope Foundation and Contributors zope.event-4.2.0/CHANGES.rst 0000664 0001750 0001750 00000002724 12661103430 016563 0 ustar tseaver tseaver 0000000 0000000 ``zope.event`` Changelog
========================
4.2.0 (2016-02-17)
------------------
- Add support for Python 3.5.
- Drop support for Python 2.6 and 3.2.
4.1.0 (2015-10-18)
------------------
- Require 100% branch (as well as statement) coverage.
- Add a simple class-based handler implementation.
4.0.3 (2014-03-19)
------------------
- Add support for Python 3.4.
- Update ``boostrap.py`` to version 2.2.
4.0.2 (2012-12-31)
------------------
- Flesh out PyPI Trove classifiers.
- Add support for jython 2.7.
4.0.1 (2012-11-21)
------------------
- Add support for Python 3.3.
4.0.0 (2012-05-16)
------------------
- Automate build of Sphinx HTML docs and running doctest snippets via tox.
- Drop explicit support for Python 2.4 / 2.5 / 3.1.
- Add support for PyPy.
3.5.2 (2012-03-30)
------------------
- This release is the last which will maintain support for Python 2.4 /
Python 2.5.
- Add support for continuous integration using ``tox`` and ``jenkins``.
- Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs
``nose`` and ``coverage``).
- Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies).
3.5.1 (2011-08-04)
------------------
- Add Sphinx documentation.
3.5.0 (2010-05-01)
------------------
- Add change log to ``long-description``.
- Add support for Python 3.x.
3.4.1 (2009-03-03)
------------------
- A few minor cleanups.
3.4.0 (2007-07-14)
------------------
- Initial release as a separate project.
zope.event-4.2.0/LICENSE.txt 0000664 0001750 0001750 00000004026 12450532135 016605 0 ustar tseaver tseaver 0000000 0000000 Zope Public License (ZPL) Version 2.1
A copyright notice accompanies this license document that identifies the
copyright holders.
This license has been certified as open source. It has also been designated as
GPL compatible by the Free Software Foundation (FSF).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions in source code must retain the accompanying copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the accompanying copyright
notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Names of the copyright holders must not be used to endorse or promote
products derived from this software without prior written permission from the
copyright holders.
4. The right to distribute this software or to use it for any purpose does not
give you the right to use Servicemarks (sm) or Trademarks (tm) of the
copyright
holders. Use of them is covered by separate agreement with the copyright
holders.
5. If any files are modified, you must cause the modified files to carry
prominent notices stating that you changed the files and the date of any
change.
Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
zope.event-4.2.0/README.rst 0000664 0001750 0001750 00000001733 12661101450 016447 0 ustar tseaver tseaver 0000000 0000000 ``zope.event`` README
=====================
.. image:: https://img.shields.io/pypi/v/zope.event.svg
:target: https://pypi.python.org/pypi/zope.event/
:alt: Latest Version
.. image:: https://travis-ci.org/zopefoundation/zope.event.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.event
.. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest
:target: http://zopeevent.readthedocs.org/en/latest/
:alt: Documentation Status
The ``zope.event`` package provides a simple event system, including:
- An event publishing API, intended for use by applications which are
unaware of any subscribers to their events.
- A very simple event-dispatching system on which more sophisticated
event dispatching systems can be built. For example, a type-based
event dispatching system that builds on ``zope.event`` can be found in
``zope.component``.
Please see http://zopeevent.rtfd.org/ for the documentation.
zope.event-4.2.0/docs/ 0000775 0001750 0001750 00000000000 12661103467 015716 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/docs/api.rst 0000664 0001750 0001750 00000000356 12460222364 017220 0 ustar tseaver tseaver 0000000 0000000 .. _api-docs:
:mod:`zope.event` API Reference
===============================
The package exports the following API symbols.
Data
----
.. autodata:: zope.event.subscribers
Functions
---------
.. autofunction:: zope.event.notify
zope.event-4.2.0/docs/make.bat 0000664 0001750 0001750 00000006005 12450532135 017316 0 ustar tseaver tseaver 0000000 0000000 @ECHO OFF
REM Command file for Sphinx documentation
set SPHINXBUILD=sphinx-build
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^` where ^ is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\zopeevent.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopeevent.ghc
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end
zope.event-4.2.0/docs/Makefile 0000664 0001750 0001750 00000006074 12450532135 017357 0 ustar tseaver tseaver 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zopeevent.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopeevent.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
zope.event-4.2.0/docs/theory.rst 0000664 0001750 0001750 00000000755 12460222364 017764 0 ustar tseaver tseaver 0000000 0000000 .. _theory-docs:
Theory of Operation
===================
.. note::
This section explains both why an application or framework might
publish events, and various ways the integrator might configure
the subscribers to achieve different goals.
Outline
-------
- Events as decoupling mechanism.
- Injecting policy into reusable applications.
- Extending frameworks.
- Event dispatch strategies
- Type-based dispatch, as used in ZCA
- Attribute-based / key-based dispatch
zope.event-4.2.0/docs/_static/ 0000775 0001750 0001750 00000000000 12661103467 017344 5 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/docs/_static/.gitignore 0000664 0001750 0001750 00000000000 12460222364 021315 0 ustar tseaver tseaver 0000000 0000000 zope.event-4.2.0/docs/conf.py 0000664 0001750 0001750 00000015137 12450532135 017216 0 ustar tseaver tseaver 0000000 0000000 # -*- coding: utf-8 -*-
#
# zope.event documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 16 17:22:42 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os, pkg_resources
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
sys.path.append(os.path.abspath('../src'))
rqmt = pkg_resources.require('zope.event')[0]
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'zope.event'
copyright = u'2010, Zope Foundation and Contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '%s.%s' % tuple(map(int, rqmt.version.split('.')[:2]))
# The full version, including alpha/beta/rc tags.
release = rqmt.version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'zopeeventdoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'zopeevent.tex', u'zope.event Documentation',
u'Zope Foundation and Contributors', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
zope.event-4.2.0/docs/usage.rst 0000664 0001750 0001750 00000003424 12460222364 017552 0 ustar tseaver tseaver 0000000 0000000 .. _usage-docs:
Using :mod:`zope.event`
=======================
The :mod:`zope.event` package has a list of subscribers. Application code
can manage subscriptions by manipulating this list. For the examples here,
we'll save the current contents away and empty the list. We'll restore the
contents when we're done with our examples.
.. doctest::
>>> import zope.event
>>> old_subscribers = zope.event.subscribers[:]
>>> del zope.event.subscribers[:]
The package provides a :func:`notify` function, which is used to
notify subscribers that something has happened:
.. doctest::
>>> class MyEvent:
... pass
>>> event = MyEvent()
>>> zope.event.notify(event)
The notify function is called with a single object, which we call an
event. Any object will do:
.. doctest::
>>> zope.event.notify(None)
>>> zope.event.notify(42)
An extremely trivial subscription mechanism is provided. Subscribers
are simply callback functions:
.. doctest::
>>> def f(event):
... print 'got:', event
that are put into the subscriptions list:
.. doctest::
>>> zope.event.subscribers.append(f)
>>> zope.event.notify(42)
got: 42
>>> def g(event):
... print 'also got:', event
>>> zope.event.subscribers.append(g)
>>> zope.event.notify(42)
got: 42
also got: 42
To unsubscribe, simply remove a subscriber from the list:
.. doctest::
>>> zope.event.subscribers.remove(f)
>>> zope.event.notify(42)
also got: 42
Generally, application frameworks will provide more sophisticated
subscription mechanisms that build on this simple mechanism. The
frameworks will install subscribers that then dispatch to other
subscribers based on event types or data.
We're done, so we'll restore the subscribers:
.. doctest::
>>> zope.event.subscribers[:] = old_subscribers
zope.event-4.2.0/docs/index.rst 0000664 0001750 0001750 00000001160 12661101450 017543 0 ustar tseaver tseaver 0000000 0000000 :mod:`zope.event` Documentation
===============================
This package provides a simple event system on which
application-specific event systems can be built.
Application code can generate events without being concerned about the
event-processing frameworks that might handle the events.
Events are objects that represent something happening in a system.
They are used to extend processing by providing processing plug
points.
Contents:
.. toctree::
:maxdepth: 2
usage
theory
api
classhandler
hacking
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
zope.event-4.2.0/docs/classhandler.rst 0000664 0001750 0001750 00000002105 12661101450 021077 0 ustar tseaver tseaver 0000000 0000000 Class-based event handlers
==========================
A light-weight event-handler framework based on event classes is
provided by the ``zope.event.classhandler`` module.
Handlers are registered for event classes:
>>> import zope.event.classhandler
>>> class MyEvent(object):
... def __repr__(self):
... return self.__class__.__name__
>>> def handler1(event):
... print("handler1 %r" % event)
>>> zope.event.classhandler.handler(MyEvent, handler1)
Descriptor syntax:
>>> @zope.event.classhandler.handler(MyEvent)
... def handler2(event):
... print("handler2 %r" % event)
>>> class MySubEvent(MyEvent):
... pass
>>> @zope.event.classhandler.handler(MySubEvent)
... def handler3(event):
... print("handler3 %r" % event)
Subscribers are called in class method-resolution order, so only
new-style event classes are supported, and then by order of registry.
>>> import zope.event
>>> zope.event.notify(MySubEvent())
handler3 MySubEvent
handler1 MySubEvent
handler2 MySubEvent
zope.event-4.2.0/docs/hacking.rst 0000664 0001750 0001750 00000020550 12470403043 020045 0 ustar tseaver tseaver 0000000 0000000 Hacking on :mod:`zope.event`
============================
Getting the Code
################
The main repository for :mod:`zope.event` is in the Zope Foundation
Github repository:
https://github.com/zopefoundation/zope.event
You can get a read-only checkout from there:
.. code-block:: sh
$ git clone https://github.com/zopefoundation/zope.event.git
or fork it and get a writeable checkout of your fork:
.. code-block:: sh
$ git clone git@github.com/jrandom/zope.event.git
The project also mirrors the trunk from the Github repository as a
Bazaar branch on Launchpad:
https://code.launchpad.net/zope.event
You can branch the trunk from there using Bazaar:
.. code-block:: sh
$ bzr branch lp:zope.event
Working in a ``virtualenv``
###########################
Installing
----------
If you use the ``virtualenv`` package to create lightweight Python
development environments, you can run the tests using nothing more
than the ``python`` binary in a virtualenv. First, create a scratch
environment:
.. code-block:: sh
$ /path/to/virtualenv --no-site-packages /tmp/hack-zope.event
Next, get this package registered as a "development egg" in the
environment:
.. code-block:: sh
$ /tmp/hack-zope.event/bin/python setup.py develop
Running the tests
-----------------
Then, you canrun the tests using the build-in ``setuptools`` testrunner:
.. code-block:: sh
$ /tmp/hack-zope.event/bin/python setup.py test
running test
...
test_empty (zope.event.tests.Test_notify) ... ok
test_not_empty (zope.event.tests.Test_notify) ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK
If you have the :mod:`nose` package installed in the virtualenv, you can
use its testrunner too:
.. code-block:: sh
$ /tmp/hack-zope.event/bin/easy_install nose
...
$ /tmp/hack-zope.event/bin/python setup.py nosetests
running nosetests
...
----------------------------------------------------------------------
Ran 3 tests in 0.011s
OK
or:
.. code-block:: sh
$ /tmp/hack-zope.event/bin/nosetests
...
----------------------------------------------------------------------
Ran 3 tests in 0.011s
OK
If you have the :mod:`coverage` pacakge installed in the virtualenv,
you can see how well the tests cover the code:
.. code-block:: sh
$ /tmp/hack-zope.event/bin/easy_install nose coverage
...
$ /tmp/hack-zope.event/bin/python setup.py nosetests \
--with coverage --cover-package=zope.event
running nosetests
...
Name Stmts Exec Cover Missing
------------------------------------------
zope.event 5 5 100%
----------------------------------------------------------------------
Ran 3 tests in 0.019s
OK
Building the documentation
--------------------------
:mod:`zope.event` uses the nifty :mod:`Sphinx` documentation system
for building its docs. Using the same virtualenv you set up to run the
tests, you can build the docs:
.. code-block:: sh
$ /tmp/hack-zope.event/bin/easy_install Sphinx
...
$ cd docs
$ PATH=/tmp/hack-zope.event/bin:$PATH make html
sphinx-build -b html -d _build/doctrees . _build/html
...
build succeeded.
Build finished. The HTML pages are in _build/html.
You can also test the code snippets in the documentation:
.. code-block:: sh
$ PATH=/tmp/hack-zope.event/bin:$PATH make doctest
sphinx-build -b doctest -d _build/doctrees . _build/doctest
...
running tests...
Document: index
---------------
1 items passed all tests:
17 tests in default
17 tests in 1 items.
17 passed and 0 failed.
Test passed.
Doctest summary
===============
17 tests
0 failures in tests
0 failures in setup code
build succeeded.
Testing of doctests in the sources finished, look at the \
results in _build/doctest/output.txt.
Using :mod:`zc.buildout`
########################
Setting up the buildout
-----------------------
:mod:`zope.event` ships with its own :file:`buildout.cfg` file and
:file:`bootstrap.py` for setting up a development buildout:
.. code-block:: sh
$ /path/to/python2.6 bootstrap.py
...
Generated script '.../bin/buildout'
$ bin/buildout
Develop: '/home/jrandom/projects/Zope/zope.event/.'
...
Generated script '.../bin/sphinx-quickstart'.
Generated script '.../bin/sphinx-build'.
Running the tests
-----------------
You can now run the tests:
.. code-block:: sh
$ bin/test --all
Running zope.testing.testrunner.layer.UnitTests tests:
Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
Ran 2 tests with 0 failures and 0 errors in 0.000 seconds.
Tearing down left over layers:
Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
Using :mod:`tox`
################
Running Tests on Multiple Python Versions
-----------------------------------------
`tox `_ is a Python-based test automation
tool designed to run tests against multiple Python versions. It creates
a ``virtualenv`` for each configured version, installs the current package
and configured dependencies into each ``virtualenv``, and then runs the
configured commands.
:mod:`zope.event` configures the following :mod:`tox` environments via
its ``tox.ini`` file:
- The ``py26``, ``py27``, ``py33``, ``py34``, and ``pypy`` environments
builds a ``virtualenv`` with the corresponding interpreter,
installs :mod:`zope.event` and dependencies, and runs the tests
via ``python setup.py -q test -q``.
- The ``coverage`` environment builds a ``virtualenv`` with ``python2.6``,
installs :mod:`zope.event`, installs
:mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement
and branch coverage.
- The ``docs`` environment builds a virtualenv with ``python2.6``, installs
:mod:`zope.event`, installs ``Sphinx`` and
dependencies, and then builds the docs and exercises the doctest snippets.
This example requires that you have a working ``python2.6`` on your path,
as well as installing ``tox``:
.. code-block:: sh
$ tox -e py26
GLOB sdist-make: .../zope.event/setup.py
py26 sdist-reinst: .../zope.event/.tox/dist/zope.event-4.0.2dev.zip
py26 runtests: commands[0]
...
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK
___________________________________ summary ____________________________________
py26: commands succeeded
congratulations :)
Running ``tox`` with no arguments runs all the configured environments,
including building the docs and testing their snippets:
.. code-block:: sh
$ tox
GLOB sdist-make: .../zope.event/setup.py
py26 sdist-reinst: .../zope.event/.tox/dist/zope.event-4.0.2dev.zip
py26 runtests: commands[0]
...
Doctest summary
===============
17 tests
0 failures in tests
0 failures in setup code
0 failures in cleanup code
build succeeded.
___________________________________ summary ____________________________________
py26: commands succeeded
py27: commands succeeded
py32: commands succeeded
pypy: commands succeeded
coverage: commands succeeded
docs: commands succeeded
congratulations :)
Contributing to :mod:`zope.event`
#################################
Submitting a Bug Report
-----------------------
:mod:`zope.event` tracks its bugs on Github:
https://github.com/zopefoundation/zope.event/issues
Please submit bug reports and feature requests there.
Sharing Your Changes
--------------------
.. note::
Please ensure that all tests are passing before you submit your code.
If possible, your submission should include new tests for new features
or bug fixes, although it is possible that you may have tested your
new code by updating existing tests.
If have made a change you would like to share, the best route is to fork
the Githb repository, check out your fork, make your changes on a branch
in your fork, and push it. You can then submit a pull request from your
branch:
https://github.com/zopefoundation/zope.event/pulls
If you branched the code from Launchpad using Bazaar, you have another
option: you can "push" your branch to Launchpad:
.. code-block:: sh
$ bzr push lp:~jrandom/zope.event/cool_feature
After pushing your branch, you can link it to a bug report on Github,
or request that the maintainers merge your branch using the Launchpad
"merge request" feature.
zope.event-4.2.0/MANIFEST.in 0000664 0001750 0001750 00000000271 12533102057 016514 0 ustar tseaver tseaver 0000000 0000000 include *.rst
include *.txt
recursive-include docs *
recursive-include src *
global-exclude *.dll
global-exclude *.pyc
global-exclude *.pyo
global-exclude *.so
global-exclude *.class