[Checkins] SVN: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ Get all the http tests passing using the twisted trunk.

Michael Kerrin michael.kerrin at openapp.biz
Thu Nov 2 16:04:40 EST 2006


Log message for revision 71037:
  Get all the http tests passing using the twisted trunk.
  

Changed:
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/http.py
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/log.txt

-=-
Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/http.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/http.py	2006-11-02 20:14:38 UTC (rev 71036)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/http.py	2006-11-02 21:04:39 UTC (rev 71037)
@@ -29,6 +29,7 @@
 max_stringio = 100*1000 # Should this be configurable?
 
 class Prebuffer(resource.WrapperResource):
+
     def hook(self, ctx):
         req = iweb.IRequest(ctx)
 
@@ -52,12 +53,6 @@
             
         return stream.readStream(req.stream, temp.write).addCallback(done)
 
-    # Oops, fix missing () in lambda in WrapperResource
-    def locateChild(self, ctx, segments):
-        x = self.hook(ctx)
-        if x is not None:
-            return x.addCallback(lambda data: (self.res, segments))
-        return self.res, segments
 
 def createHTTPFactory(db):
     resource = wsgi.WSGIResource(WSGIPublisherApplication(db))
@@ -69,6 +64,7 @@
 http = ServerType(createHTTPFactory, 8080)
 https = SSLServerType(createHTTPFactory, 8443)
 
+
 def createPMHTTPFactory(db):
     resource = wsgi.WSGIResource(PMDBWSGIPublisherApplication(db))
     resource = log.LogWrapperResource(resource)

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/log.txt
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/log.txt	2006-11-02 20:14:38 UTC (rev 71036)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/log.txt	2006-11-02 21:04:39 UTC (rev 71037)
@@ -51,10 +51,16 @@
   ...     def getRemoteHost(self):
   ...         return type('TestRemoteHost', (), {'host': '127.0.0.1'})
 
-  >>> chanRequest = TestHTTPChannel(None, 'GET /index.html HTTP/1.1', 1)
+  >>> chanRequest = TestHTTPChannel(None, 1)
   >>> request = http.Request(chanRequest, 'GET', '/index.html', (1, 1),
-  ...                        http_headers.Headers())
+  ...                        0, http_headers.Headers())
 
+XXX - Where in Twisted is this set up during the processing of a live request,
+as it is probable more interesting to try and replicate that - as this seems
+wrong.
+
+  >>> request.remoteAddr = chanRequest.getRemoteHost()
+
   >>> response = http.Response()
   >>> response.headers.setHeader('date', 1120000000)
 
@@ -69,7 +75,7 @@
 
   >>> eventDict = {'interface': iweb.IRequest,
   ...              'request': request, 'response': response,
-  ...              'context': FauxContext()}
+  ...              'loginfo': FauxContext()}
 
 If we now emit a log event, we should receive an entry:
 



More information about the Checkins mailing list