[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/recorder/ Fixed
broken HTTP session recorder
Dmitry Vasiliev
dima at hlabs.spb.ru
Thu Oct 13 09:03:40 EDT 2005
Log message for revision 39115:
Fixed broken HTTP session recorder
Changed:
U Zope3/trunk/src/zope/app/recorder/__init__.py
U Zope3/trunk/src/zope/app/recorder/configure.zcml
-=-
Modified: Zope3/trunk/src/zope/app/recorder/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/recorder/__init__.py 2005-10-13 12:03:27 UTC (rev 39114)
+++ Zope3/trunk/src/zope/app/recorder/__init__.py 2005-10-13 13:03:40 UTC (rev 39115)
@@ -18,20 +18,15 @@
__docformat__ = 'restructuredtext'
import time
-import thread
import threading
-import cStringIO
+from cStringIO import StringIO
-import twisted.web2.wsgi
from twisted.protocols import policies
-import transaction
-import ZODB.MappingStorage
-from ZODB.POSException import ConflictError
-from BTrees.IOBTree import IOBTree
-from zope.app import wsgi
+from zope.app.twisted.http import createHTTPFactory
from zope.app.twisted.server import ServerType
+
class RecordingProtocol(policies.ProtocolWrapper):
"""A special protocol that keeps track of all input and output of an HTTP
connection.
@@ -41,8 +36,8 @@
def __init__(self, factory, wrappedProtocol):
policies.ProtocolWrapper.__init__(self, factory, wrappedProtocol)
- self.input = cStringIO.StringIO()
- self.output = cStringIO.StringIO()
+ self.input = StringIO()
+ self.output = StringIO()
self.chanRequest = None
def dataReceived(self, data):
@@ -78,18 +73,15 @@
) )
-class RecordingFactory(policies.WrappingFactory):
+class RecordingWrapper(policies.WrappingFactory):
"""Special server factory that supports recording."""
protocol = RecordingProtocol
def createRecordingHTTPFactory(db):
- resource = twisted.web2.wsgi.WSGIResource(
- wsgi.WSGIPublisherApplication(db))
+ return RecordingWrapper(createHTTPFactory(db))
- return RecordingFactory(twisted.web2.server.Site(resource))
-
class RecordedRequest(object):
"""A single recorded request and response."""
Modified: Zope3/trunk/src/zope/app/recorder/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/recorder/configure.zcml 2005-10-13 12:03:27 UTC (rev 39114)
+++ Zope3/trunk/src/zope/app/recorder/configure.zcml 2005-10-13 13:03:40 UTC (rev 39115)
@@ -4,7 +4,7 @@
<utility
- name="Twisted-RecordingHTTP"
+ name="RecordingHTTP"
component=".recordinghttp"
provides="zope.app.twisted.interfaces.IServerType"
/>
More information about the Zope3-Checkins
mailing list