[Checkins] SVN: Sandbox/shane/republish/zope.p Added test setup code and fixed trivial errors

Shane Hathaway shane at hathawaymix.org
Sun Feb 15 03:55:43 EST 2009


Log message for revision 96559:
  Added test setup code and fixed trivial errors
  

Changed:
  U   Sandbox/shane/republish/zope.pipeline/setup.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/configure.zcml
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/interfaces.py
  A   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/basicconfig.txt
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/tests.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/zcml.py
  U   Sandbox/shane/republish/zope.publisher/setup.py
  A   Sandbox/shane/republish/zope.publisher/src/zope/publisher/interfaces/event.py

-=-
Modified: Sandbox/shane/republish/zope.pipeline/setup.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/setup.py	2009-02-15 06:48:28 UTC (rev 96558)
+++ Sandbox/shane/republish/zope.pipeline/setup.py	2009-02-15 08:55:43 UTC (rev 96559)
@@ -20,31 +20,44 @@
 #main = zope.pipeline.entry:create_pipeline
 #"""
 
-setup(name='zope.pipeline',
-      version = '0.1dev',
-      url='http://pypi.python.org/pypi/zope.pipeline',
-      license='ZPL 2.1',
-      author='Zope Corporation and Contributors',
-      author_email='zope-dev at zope.org',
-      description="Zope object publisher based on a WSGI pipeline",
-      long_description=(open('README.txt').read()
-                        + '\n\n'
-                        + open('CHANGES.txt').read()),
+setup(
+    name='zope.pipeline',
+    version = '0.1dev',
+    url='http://pypi.python.org/pypi/zope.pipeline',
+    license='ZPL 2.1',
+    author='Zope Corporation and Contributors',
+    author_email='zope-dev at zope.org',
+    description="Zope object publisher based on a WSGI pipeline",
+    long_description=(
+        open('README.txt').read()
+        + '\n\n'
+        + open('CHANGES.txt').read()),
 
       #entry_points = entry_points,
 
-      packages=find_packages('src'),
-      package_dir = {'': 'src'},
+    packages=find_packages('src'),
+    package_dir = {'': 'src'},
 
-      namespace_packages=['zope',],
-      install_requires=['setuptools',
-                        'zope.publisher',
-                        'zope.interface',
-                        ],
-      extras_require=dict(
-          test = ['zope.testing'],
-          ),
-      include_package_data = True,
+    namespace_packages=['zope',],
+    install_requires=[
+        'setuptools',
+        'transaction',
+        'ZODB3',
+        #'zope.app.security',
+        'zope.component',
+        'zope.httpform',
+        'zope.i18n',
+        'zope.interface',
+        'zope.publisher',
+        'zope.security',
+        ],
+    extras_require=dict(
+        test=[
+            'zope.testing',
+            'zope.configuration',
+            ],
+        ),
+    include_package_data = True,
 
-      zip_safe = False,
-      )
+    zip_safe = False,
+    )

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/configure.zcml
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/configure.zcml	2009-02-15 06:48:28 UTC (rev 96558)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/configure.zcml	2009-02-15 08:55:43 UTC (rev 96559)
@@ -54,9 +54,9 @@
     for=".interfaces.INoRequest" />
 
 
-<wsgi:application
+<!--wsgi:application
     name="log"
-    factory="..." />
+    factory="..." /-->
 
 <wsgi:application
     name="open_root"
@@ -68,11 +68,11 @@
 
 <wsgi:application
     name="event"
-    factory=".apps.notify.EventNotifier" />
+    factory=".apps.event.EventNotifier" />
 
-<wsgi:application
+<!--wsgi:application
     name="handle_error"
-    factory="..." />
+    factory="..." /-->
 
 <!-- no form processing for non-browser requests -->
 <wsgi:application
@@ -86,9 +86,9 @@
     factory=".apps.requestsetup.ProcessForm"
     for="zope.publisher.interfaces.browser.IBrowserRequest" />
 
-<wsgi:application
+<!--wsgi:application
     name="authenticate"
-    factory=".apps.authenticate.Authenticator" />
+    factory=".apps.authenticate.Authenticator" /-->
 
 <wsgi:application
     name="traverse"

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/interfaces.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/interfaces.py	2009-02-15 06:48:28 UTC (rev 96558)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/interfaces.py	2009-02-15 08:55:43 UTC (rev 96559)
@@ -65,7 +65,7 @@
 
     Chooses factories based on the wsgi.url_scheme, the
     REQUEST_METHOD, and the CONTENT_TYPE.  Multiple factories
-    can be configured schema, method, and content type.
+    can be configured for each schema, method, and content type.
     The factory itself can introspect the environment to decide
     if it can handle the request as given by the environment or not.
     Factories are sorted in descending order of priority, so a
@@ -81,7 +81,6 @@
         factories (basically for testing, not for introspection).
         """
 
-    def lookup(method, mimetype, environment):
-        """Lookup a factory for a given method+mimetype and a
-        environment.
+    def make_request(scheme, method, mimetype, environment):
+        """Create a request object.
         """

Added: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/basicconfig.txt
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/basicconfig.txt	                        (rev 0)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/basicconfig.txt	2009-02-15 08:55:43 UTC (rev 96559)
@@ -0,0 +1 @@
+

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/tests.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/tests.py	2009-02-15 06:48:28 UTC (rev 96558)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/tests/tests.py	2009-02-15 08:55:43 UTC (rev 96559)
@@ -16,12 +16,23 @@
 import unittest
 
 from zope.testing import doctest
+from zope.testing.cleanup import cleanUp
+from zope.configuration.xmlconfig import XMLConfig
 
+import zope.pipeline
+
+def setUp(doctest):
+    cleanUp()
+    XMLConfig('meta.zcml', zope.pipeline)()
+    XMLConfig('configure.zcml', zope.pipeline)()
+
+def tearDown(doctest):
+    cleanUp()
+
 def test_suite():
     return unittest.TestSuite([
-        doctest.DocFileSuite(
-            'autotemp_test.txt',
-            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+        doctest.DocFileSuite('autotemp_test.txt'),
+        doctest.DocFileSuite('basicconfig.txt', setUp=setUp, tearDown=tearDown),
     ])
 
 if __name__ == '__main__':

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/zcml.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/zcml.py	2009-02-15 06:48:28 UTC (rev 96558)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/zcml.py	2009-02-15 08:55:43 UTC (rev 96559)
@@ -21,6 +21,7 @@
 from zope.configuration.fields import GlobalObject
 from zope.configuration.fields import Tokens
 from zope.interface import Interface
+from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 from zope.schema import Int
 from zope.schema import TextLine
@@ -43,7 +44,8 @@
         description=(
             u'The list of WSGI application names to use. '
             u'The last name in the list declares a simple application; '
-            u'the rest declare a middleware application.'))
+            u'the rest declare a middleware application.'),
+        value_type=TextLine())
 
 class PipelineApplicationList(object):
     implements(IPipelineApplicationList)
@@ -58,8 +60,8 @@
 def pipeline(_context, for_, names):
     """Register a pipeline application list"""
     obj = PipelineApplicationList(names)
-    adapter(_context, factory=obj.adapt,
-        provides=[IPipelineApplicationList], for_=for_)
+    adapter(_context, factory=(obj.adapt,),
+        provides=IPipelineApplicationList, for_=for_)
 
 
 
@@ -112,11 +114,11 @@
 def application(_context, factory, name, for_=()):
     """Register a WSGI application"""
     if not for_:
-        for_ = [IRequest]
+        for_ = (IRequest,)
     factory_factory = WSGIApplicationFactory(factory)
     adapter(_context,
-        factory=[factory_factory.adapt],
-        provides=[IWSGIApplicationFactory],
+        factory=(factory_factory.adapt,),
+        provides=IWSGIApplicationFactory,
         for_=for_, name=name)
 
 
@@ -148,7 +150,7 @@
     methods = Tokens(
         title=u'Methods',
         description=(u'A list of HTTP method names. If the method is a "*", '
-                     u'then all methods will match. Example: "GET POST"',
+                     u'then all methods will match. Example: "GET POST"'),
         value_type=TextLine(),
         required=False)
 
@@ -168,7 +170,7 @@
         required=False)
 
 def request_factory(_context, name, factory,
-    schemes=['http', 'https'], methods=['*'], mimetypes=['*'], priority=0):
+    schemes=('http', 'https'), methods=('*',), mimetypes=('*',), priority=0):
 
     factory = factory()
 

Modified: Sandbox/shane/republish/zope.publisher/setup.py
===================================================================
--- Sandbox/shane/republish/zope.publisher/setup.py	2009-02-15 06:48:28 UTC (rev 96558)
+++ Sandbox/shane/republish/zope.publisher/setup.py	2009-02-15 08:55:43 UTC (rev 96559)
@@ -24,31 +24,36 @@
 #"""
 
 setup(name='zope.publisher',
-      version = '4.0.0dev',
-      url='http://pypi.python.org/pypi/zope.publisher',
-      license='ZPL 2.1',
-      author='Zope Corporation and Contributors',
-      author_email='zope-dev at zope.org',
-      description="Interfaces for publishing Python objects on the web.",
-      long_description=(open('README.txt').read()
-                        + '\n\n'
-                        + open('CHANGES.txt').read()),
+    version = '4.0.0dev',
+    url='http://pypi.python.org/pypi/zope.publisher',
+    license='ZPL 2.1',
+    author='Zope Corporation and Contributors',
+    author_email='zope-dev at zope.org',
+    description="Interfaces for publishing Python objects on the web.",
+    long_description=(
+        open('README.txt').read()
+        + '\n\n'
+        + open('CHANGES.txt').read()),
 
-      #entry_points = entry_points,
+    #entry_points = entry_points,
 
-      packages=find_packages('src'),
-      package_dir = {'': 'src'},
+    packages=find_packages('src'),
+    package_dir = {'': 'src'},
 
-      namespace_packages=['zope',],
-      install_requires=['setuptools',
-                        #'zope.deferredimport',
-                        'zope.interface',
-                        'zope.location',
-                        ],
-      extras_require=dict(
-          test = ['zope.testing'],
-          ),
-      include_package_data = True,
+    namespace_packages=['zope',],
+    install_requires=[
+        'setuptools',
+        'zope.component',
+        #'zope.deferredimport',
+        'zope.interface',
+        'zope.location',
+        ],
+    extras_require=dict(
+        test=[
+            'zope.testing',
+            ],
+        ),
+    include_package_data = True,
 
-      zip_safe = False,
-      )
+    zip_safe = False,
+    )

Added: Sandbox/shane/republish/zope.publisher/src/zope/publisher/interfaces/event.py
===================================================================
--- Sandbox/shane/republish/zope.publisher/src/zope/publisher/interfaces/event.py	                        (rev 0)
+++ Sandbox/shane/republish/zope.publisher/src/zope/publisher/interfaces/event.py	2009-02-15 08:55:43 UTC (rev 96559)
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation 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.
+#
+##############################################################################
+"""Event Interfaces
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.interface import Attribute
+from zope.interface import implements
+from zope.interface import Interface
+from zope.component.interfaces import IObjectEvent
+
+class IBeforeTraverseEvent(IObjectEvent):
+    """An event which gets sent on publication traverse"""
+
+    request = Attribute("The current request")
+
+class BeforeTraverseEvent(object):
+    """An event which gets sent on publication traverse"""
+
+    implements(IBeforeTraverseEvent)
+
+    def __init__(self, ob, request):
+        self.object = ob
+        self.request = request
+
+
+class IEndRequestEvent(Interface):
+    """An event which gets sent when the publication is ended"""
+
+
+class EndRequestEvent(object):
+    """An event which gets sent when the publication is ended"""
+
+    implements(IEndRequestEvent)
+
+    def __init__(self, ob, request):
+        self.object = ob
+        self.request = request



More information about the Checkins mailing list