[z3-checkins] r13930 - in z3/pipelines/trunk: . example

ivo at codespeak.net ivo at codespeak.net
Sun Jun 26 13:29:14 CEST 2005


Author: ivo
Date: Sun Jun 26 13:29:13 2005
New Revision: 13930

Added:
   z3/pipelines/trunk/example/
   z3/pipelines/trunk/example/filters.py
      - copied, changed from r13929, z3/pipelines/trunk/filters.py
Removed:
   z3/pipelines/trunk/filters.py
Modified:
   z3/pipelines/trunk/configure.zcml
Log:
moved example code to a subpackage

Modified: z3/pipelines/trunk/configure.zcml
==============================================================================
--- z3/pipelines/trunk/configure.zcml	(original)
+++ z3/pipelines/trunk/configure.zcml	Sun Jun 26 13:29:13 2005
@@ -3,35 +3,6 @@
     xmlns:pipeline="http://namespaces.zope.org/pipeline"
     >
 
-<subscriber
-    for="zope.app.publication.interfaces.IEndRequestEvent" 
-    handler=".event.doResponsePipeline"
-    />
-
-<pipeline:pipeline
-    package="pipelines.pipeline"
-    name="foo">
-  <pipeline:filter
-    id="domify"
-    factory=".filters.domify"
-    />
-  <pipeline:filter
-    id="addcopy"
-    factory=".filters.addcopy"
-    />
-  <pipeline:filter
-    id="stringify"
-    factory=".filters.stringify"
-    />
-</pipeline:pipeline>
-
-<utility
- provides="pipelines.interfaces.IPipeline"
- component="pipelines.pipeline.foo" 
- name="foo" />
-
-<subscriber
- for="zope.app.publication.interfaces.IEndRequestEvent"
- handler="pipelines.pipeline.foo" />
+<!-- no exciting configuration to be done (yet) -->
 
 </configure>

Copied: z3/pipelines/trunk/example/filters.py (from r13929, z3/pipelines/trunk/filters.py)
==============================================================================
--- z3/pipelines/trunk/filters.py	(original)
+++ z3/pipelines/trunk/example/filters.py	Sun Jun 26 13:29:13 2005
@@ -2,12 +2,6 @@
 from pipelines.interfaces import IFilter, AbortPipelineException
 from zope.interface import Interface, implements
 
-class tidy(object):
-    implements(IFilter)
-
-    def __call__(self, data, state):
-        pass
-
 from xml.dom.minidom import parseString
 from xml.dom.minidom import Element, Text
 from xml.parsers.expat import ExpatError

Deleted: /z3/pipelines/trunk/filters.py
==============================================================================
--- /z3/pipelines/trunk/filters.py	Sun Jun 26 13:29:13 2005
+++ (empty file)
@@ -1,45 +0,0 @@
-# demo package, to test if everything works
-from pipelines.interfaces import IFilter, AbortPipelineException
-from zope.interface import Interface, implements
-
-class tidy(object):
-    implements(IFilter)
-
-    def __call__(self, data, state):
-        pass
-
-from xml.dom.minidom import parseString
-from xml.dom.minidom import Element, Text
-from xml.parsers.expat import ExpatError
-
-class domify(object):
-    implements(IFilter)
-
-    def __call__(self, data, state):
-        try:
-            state.dom = parseString(data.request.response._body)
-        except ExpatError:
-            raise AbortPipelineException, "Error during xml parsing" 
-
-class addcopy(object):
-    implements(IFilter)
-
-    def __call__(self, data, state):
-        dom = state.dom
-        graph = Element(tagName='p')
-        text = Text()
-        text.data = 'Copyright 2005 Example Company'
-        graph.appendChild(text)
-        bodytags = dom.getElementsByTagName('body')
-        if len(bodytags) > 0: # is there a body? (avoid IndexError)
-            body = bodytags[0]
-            body.appendChild(graph)
-        # else we might as well abort? Or stop gracefully?
-
-class stringify(object):
-    implements(IFilter)
-
-    def __call__(self, data, state):
-        response = data.request.response
-        dom = state.dom
-        response.setBody(dom.toxml())


More information about the z3-checkins mailing list