[Checkins] SVN: five.globalrequest/trunk/ Initial tiny implementation

Martin Aspeli optilude at gmx.net
Fri Jan 8 10:29:49 EST 2010


Log message for revision 107798:
  Initial tiny implementation

Changed:
  _U  five.globalrequest/trunk/
  A   five.globalrequest/trunk/README.txt
  A   five.globalrequest/trunk/docs/
  A   five.globalrequest/trunk/docs/HISTORY.txt
  A   five.globalrequest/trunk/five/
  A   five.globalrequest/trunk/five/__init__.py
  A   five.globalrequest/trunk/five/globalrequest/
  A   five.globalrequest/trunk/five/globalrequest/__init__.py
  A   five.globalrequest/trunk/five/globalrequest/configure.zcml
  A   five.globalrequest/trunk/five/globalrequest/hooks.py
  A   five.globalrequest/trunk/setup.py

-=-

Property changes on: five.globalrequest/trunk
___________________________________________________________________
Added: svn:ignore
   + *.egg-info


Added: five.globalrequest/trunk/README.txt
===================================================================
--- five.globalrequest/trunk/README.txt	                        (rev 0)
+++ five.globalrequest/trunk/README.txt	2010-01-08 15:29:48 UTC (rev 107798)
@@ -0,0 +1,24 @@
+Overview
+========
+
+This package integrates `zope.globalrequest <http://pypi.python.org/pypi/zope.globalrequest>`_
+with Zope 2. It is compatible with Zope 2.12 and later. In Zope 2.10, you
+can install `ZPublisherEventsBackport <http://pypi.python.org/pypi/ZPublisherEventsBackport>`_
+to use it.
+
+The only thing you need to do to use this package is to load its configuration
+from your own ZCML file::
+
+    <include package="five.globalrequest" />
+
+You can now use ``zope.globalrequest`` as normal::
+
+    from zope.globalrequest import getRequest
+    request = getRequest()
+
+The request is set up when publication starts, when the ``IPubStart`` event
+is fired. It is cleared on one of the ``IPubEnd`` events: ``IPubSuccess`` or
+``IPubFailure``. If you have your own event handlers for either of these
+events, you should be aware that the event setup/clear could happen after/
+before your own event handler is executed, since the order of execution for
+event handlers is not controllable.

Added: five.globalrequest/trunk/docs/HISTORY.txt
===================================================================
--- five.globalrequest/trunk/docs/HISTORY.txt	                        (rev 0)
+++ five.globalrequest/trunk/docs/HISTORY.txt	2010-01-08 15:29:48 UTC (rev 107798)
@@ -0,0 +1,7 @@
+Changelog
+=========
+
+1.0 - 2010-01-08
+----------------
+
+- Initial release

Added: five.globalrequest/trunk/five/__init__.py
===================================================================
--- five.globalrequest/trunk/five/__init__.py	                        (rev 0)
+++ five.globalrequest/trunk/five/__init__.py	2010-01-08 15:29:48 UTC (rev 107798)
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)

Added: five.globalrequest/trunk/five/globalrequest/configure.zcml
===================================================================
--- five.globalrequest/trunk/five/globalrequest/configure.zcml	                        (rev 0)
+++ five.globalrequest/trunk/five/globalrequest/configure.zcml	2010-01-08 15:29:48 UTC (rev 107798)
@@ -0,0 +1,15 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="five.globalrequest">
+
+    <subscriber
+        for="ZPublisher.interfaces.IPubStart"
+        handler=".hooks.set"
+        />
+    
+    <subscriber
+        for="ZPublisher.interfaces.IPubEnd"
+        handler=".hooks.clear"
+        />
+
+</configure>

Added: five.globalrequest/trunk/five/globalrequest/hooks.py
===================================================================
--- five.globalrequest/trunk/five/globalrequest/hooks.py	                        (rev 0)
+++ five.globalrequest/trunk/five/globalrequest/hooks.py	2010-01-08 15:29:48 UTC (rev 107798)
@@ -0,0 +1,7 @@
+from zope.globalrequest import setRequest, clearRequest
+
+def set(event):
+    setRequest(event.object)
+
+def clear(event):
+    clearRequest()

Added: five.globalrequest/trunk/setup.py
===================================================================
--- five.globalrequest/trunk/setup.py	                        (rev 0)
+++ five.globalrequest/trunk/setup.py	2010-01-08 15:29:48 UTC (rev 107798)
@@ -0,0 +1,32 @@
+from setuptools import setup, find_packages
+import os
+
+version = '1.0'
+
+setup(name='five.globalrequest',
+      version=version,
+      description="Zope 2 integration for zope.globalrequest",
+      long_description=open("README.txt").read() + "\n" +
+                       open(os.path.join("docs", "HISTORY.txt")).read(),
+      # Get more strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+      classifiers=[
+        "Framework :: Plone",
+        "Programming Language :: Python",
+        ],
+      keywords='zope global request',
+      author='Martin Aspeli',
+      author_email='optilude at gmail.com',
+      url='http://pypi.python.org/pypi/five.globalrequest',
+      license='ZPL',
+      packages=find_packages(exclude=['ez_setup']),
+      namespace_packages=['five'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=[
+          'setuptools',
+          'zope.globalrequest',
+          'Zope2',
+      ],
+      entry_points="""
+      """,
+      )



More information about the checkins mailing list