[Checkins] SVN: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/ removed unnecessary deps

Shane Hathaway shane at hathawaymix.org
Thu Apr 2 17:06:16 EDT 2009


Log message for revision 98796:
  removed unnecessary deps
  

Changed:
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/authenticate.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/event.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/fixrel.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/mapply.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/openroot.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/retry.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/traversal.py
  U   Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/txnctl.py

-=-
Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/authenticate.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/authenticate.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/authenticate.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -15,8 +15,6 @@
 from zope.app.security.interfaces import IAuthentication
 from zope.app.security.interfaces import IFallbackUnauthenticatedPrincipal
 from zope.component import getGlobalSiteManager
-from zope.interface import implements
-from zope.publisher.interfaces import IWSGIApplication
 from zope.security.management import endInteraction
 from zope.security.management import newInteraction
 
@@ -30,7 +28,6 @@
     The WSGI environment must contain 'zope.pipeline.request'.
     Adds a traversal hook if local authentication is enabled.
     """
-    implements(IWSGIApplication)
 
     def __init__(self, next_app, local_auth=True):
         self.next_app = next_app

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/event.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/event.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/event.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -13,8 +13,6 @@
 ##############################################################################
 
 from zope.event import notify
-from zope.interface import implements
-from zope.publisher.interfaces import IWSGIApplication
 from zope.publisher.interfaces.event import BeforeTraverseEvent
 from zope.publisher.interfaces.event import EndRequestEvent
 
@@ -29,7 +27,6 @@
     and EndRequestEvent at the appropriate times. Requires the
     'zope.pipeline.traversed' key for firing events.
     """
-    implements(IWSGIApplication)
 
     def __init__(self, next_app):
         self.next_app = next_app

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/fixrel.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/fixrel.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/fixrel.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -12,11 +12,9 @@
 #
 ##############################################################################
 
-from zope.interface import implements
 from zope.pipeline.envkeys import DEFAULT_TRAVERSAL_STEPS_KEY
 from zope.pipeline.envkeys import REQUEST_KEY
 from zope.pipeline.envkeys import STRING_RESULT_HOOKS_KEY
-from zope.publisher.interfaces import IWSGIApplication
 
 
 class FixRelativeLinks(object):
@@ -28,7 +26,6 @@
     either redirecting (before calling the app) or adding a base tag
     to the response text (after calling the app).
     """
-    implements(IWSGIApplication)
 
     allow_redirect = True
 

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/mapply.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/mapply.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/mapply.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -12,10 +12,8 @@
 #
 ##############################################################################
 
-from zope.interface import implements
 from zope.proxy import removeAllProxies
 from zope.publisher.interfaces.http import MethodNotAllowed
-from zope.publisher.interfaces import IWSGIApplication
 
 from zope.pipeline.envkeys import REQUEST_KEY
 from zope.pipeline.envkeys import TRAVERSED_KEY
@@ -27,7 +25,6 @@
     Requires 'zope.pipeline.request' and 'zope.pipeline.traversed' in
     the environment.
     """
-    implements(IWSGIApplication)
 
     def get_target(self, environ):
         """Returns the object to call."""

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/openroot.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/openroot.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/openroot.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -15,9 +15,7 @@
 import re
 
 from zope.component import getUtility
-from zope.interface import implements
 from zope.interface import Interface
-from zope.publisher.interfaces import IWSGIApplication
 from zope.security.checker import ProxyFactory
 
 from zope.pipeline.envkeys import REQUEST_KEY
@@ -38,7 +36,6 @@
     of opening the database, this uses the utility by that name as the
     root object.
     """
-    implements(IWSGIApplication)
 
     root_name = 'Application'
     app_controller_name = '++etc++process'

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/retry.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/retry.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/retry.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -13,13 +13,10 @@
 ##############################################################################
 
 from ZODB.POSException import ConflictError
-from zope.interface import implements
 from zope.publisher.interfaces.exceptions import Retry
-from zope.publisher.interfaces import IWSGIApplication
 
 from zope.pipeline.autotemp import AutoTemporaryFile
 from zope.pipeline.envkeys import CAN_RETRY_KEY
-from zope.pipeline.envkeys import RESETTABLE_KEYS
 
 
 class RetryApp(object):
@@ -30,10 +27,11 @@
     The 'handle_error' app should propagate Retry or ConflictError
     when 'zope.pipeline.can_retry' is true.
     """
-    implements(IWSGIApplication)
 
-    def __init__(self, next_app, max_attempts=3):
+    def __init__(self, next_app, retry_errors=(ConflictError, Retry),
+            max_attempts=3):
         self.next_app = next_app
+        self.retry_errors = retry_errors
         self.max_attempts = max_attempts
 
     def __call__(self, environ, start_response):
@@ -46,7 +44,7 @@
                 f = AutoTemporaryFile()
                 f.copyfrom(wsgi_input)
                 f.seek(0)
-                environ['wsgi.input'] = wsgi_input = f
+                wsgi_input = f
 
         def retryable_start_response(status, response_headers, exc_info=None):
             start_response_params[:] = [status, response_headers, exc_info]
@@ -58,13 +56,14 @@
         while attempt < self.max_attempts:
             start_response_params = []
             output_file = []
-            environ[CAN_RETRY_KEY] = True
+            env_copy = environ.copy()
+            env_copy['wsgi.input'] = wsgi_input
+            env_copy[CAN_RETRY_KEY] = True
             try:
-                res = self.next_app(environ, retryable_start_response)
-            except (Retry, ConflictError):
+                res = self.next_app(env_copy, retryable_start_response)
+            except self.retry_errors:
                 if wsgi_input is not None:
                     wsgi_input.seek(0)
-                self.reset_environ(environ)
                 attempt += 1
             else:
                 if start_response_params:
@@ -76,10 +75,4 @@
                 return res
 
         # try once more, this time without retry support
-        environ[CAN_RETRY_KEY] = False
         return self.next_app(environ, start_response)
-
-    def reset_environ(self, environ):
-        for key in RESETTABLE_KEYS:
-            if key in environ:
-                del environ[key]

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/traversal.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/traversal.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/traversal.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -13,11 +13,9 @@
 ##############################################################################
 
 from zope.component import queryMultiAdapter
-from zope.interface import implements
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.publisher.interfaces.exceptions import NotFound
 from zope.publisher.interfaces import IPublishTraverse
-from zope.publisher.interfaces import IWSGIApplication
 from zope.security.checker import ProxyFactory
 from zope.traversing.namespace import namespaceLookup
 from zope.traversing.namespace import nsParse
@@ -37,7 +35,6 @@
     'zope.pipeline.traversed' and sets
     'zope.pipeline.default_traversal_steps'.
     """
-    implements(IWSGIApplication)
 
     def __init__(self, next_app):
         self.next_app = next_app
@@ -153,7 +150,6 @@
 
 class BrowserTraverser(Traverser):
     # includes form_action and browserDefault traversal
-    implements(IWSGIApplication)
 
     def get_steps(self, environ):
         """Return the list of names to traverse.

Modified: Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/txnctl.py
===================================================================
--- Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/txnctl.py	2009-04-02 21:05:54 UTC (rev 98795)
+++ Sandbox/shane/republish/zope.pipeline/src/zope/pipeline/apps/txnctl.py	2009-04-02 21:06:16 UTC (rev 98796)
@@ -14,11 +14,9 @@
 
 from new import instancemethod
 
-from zope.interface import implements
 from zope.interface import providedBy
 from zope.location.interfaces import ILocationInfo
 from zope.publisher.interfaces import IRequest
-from zope.publisher.interfaces import IWSGIApplication
 from zope.security.proxy import removeSecurityProxy
 import transaction
 
@@ -31,7 +29,6 @@
 
     Aborts the transaction on the way in and on the way out.
     """
-    implements(IWSGIApplication)
 
     def __init__(self, next_app):
         self.next_app = next_app
@@ -50,7 +47,6 @@
     Also annotates the transaction.  Requires 'zope.pipeline.request'
     and 'zope.pipeline.traversed' in the environment.
     """
-    implements(IWSGIApplication)
 
     def __init__(self, next_app):
         self.next_app = next_app



More information about the Checkins mailing list