[Checkins] SVN: z3c.rest/trunk/ Got some compatibility stuff worked out with Roy.

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Mar 6 03:02:14 EST 2008


Log message for revision 84500:
  Got some compatibility stuff worked out with Roy.
  

Changed:
  U   z3c.rest/trunk/CHANGES.txt
  U   z3c.rest/trunk/buildout.cfg
  U   z3c.rest/trunk/setup.py
  U   z3c.rest/trunk/src/z3c/rest/client.py
  U   z3c.rest/trunk/src/z3c/rest/testing.py

-=-
Modified: z3c.rest/trunk/CHANGES.txt
===================================================================
--- z3c.rest/trunk/CHANGES.txt	2008-03-06 07:51:19 UTC (rev 84499)
+++ z3c.rest/trunk/CHANGES.txt	2008-03-06 08:02:14 UTC (rev 84500)
@@ -2,10 +2,21 @@
 CHANGES
 =======
 
+0.2.1 (2008-03-06)
+------------------
+
+- Bug: Sometimes the response body was not read and the contents of the client
+  was empty. Unfortunately, this problem could not be reliably reproduced, but
+  debugging showed that the connection was closed to early. (Roy Mathew)
+
+- Feature: Make the package Python 2.4 and 2.5 compatible.
+
+- Feature: Require lxml 2.0 for z3c.rest.
+
 0.2.0 (2008-03-03)
 ------------------
 
-- Feature: Made the HTTP caller pluggable for the REST client, allowing 
+- Feature: Made the HTTP caller pluggable for the REST client, allowing
   request types other than ``RESTRequest``.
 
 0.1.0 (2008-03-03)

Modified: z3c.rest/trunk/buildout.cfg
===================================================================
--- z3c.rest/trunk/buildout.cfg	2008-03-06 07:51:19 UTC (rev 84499)
+++ z3c.rest/trunk/buildout.cfg	2008-03-06 08:02:14 UTC (rev 84500)
@@ -1,7 +1,5 @@
 [buildout]
 develop = .
-          ../z3c.traverser
-index = http://download.zope.org/zope3.4
 parts = demo test coverage
 
 [test]

Modified: z3c.rest/trunk/setup.py
===================================================================
--- z3c.rest/trunk/setup.py	2008-03-06 07:51:19 UTC (rev 84499)
+++ z3c.rest/trunk/setup.py	2008-03-06 08:02:14 UTC (rev 84500)
@@ -31,7 +31,7 @@
 
 setup (
     name='z3c.rest',
-    version='0.3.0dev',
+    version='0.2.1',
     author = "Stephan Richter and the Zope Community",
     author_email = "zope3-dev at zope.org",
     description = "A REST Framework for Zope 3 Applications",
@@ -82,7 +82,7 @@
                 'zope.app.testing'],
         ),
     install_requires = [
-        'lxml',
+        'lxml>=2.0.0', # Changes in API, since 1.3.6.
         'setuptools',
         'z3c.traverser',
         'zope.publisher',

Modified: z3c.rest/trunk/src/z3c/rest/client.py
===================================================================
--- z3c.rest/trunk/src/z3c/rest/client.py	2008-03-06 07:51:19 UTC (rev 84499)
+++ z3c.rest/trunk/src/z3c/rest/client.py	2008-03-06 08:02:14 UTC (rev 84500)
@@ -122,7 +122,6 @@
             connection.request(
                 method, getFullPath(pieces, params), data, requestHeaders)
             response = connection.getresponse()
-            connection.close()
         except socket.error, e:
             connection.close()
             self.status, self.reason = e.args
@@ -133,6 +132,7 @@
             self.contents = response.read()
             self.status = response.status
             self.reason = response.reason
+            connection.close()
             self._addHistory()
 
     def get(self, url='', params=None, headers=None):
@@ -181,10 +181,10 @@
         res = []
         if title is not None:
             res = tree.xpath(
-                '//*[@xlink:title="%s"]' %title, nsmap)
+                '//*[@xlink:title="%s"]' %title, namespaces=nsmap)
         elif url is not None:
             res = tree.xpath(
-                '//*[@xlink:href="%s"]' %url, nsmap)
+                '//*[@xlink:href="%s"]' %url, namespaces=nsmap)
         else:
             raise ValueError('You must specify a title or URL.')
         elem = res[index]
@@ -194,7 +194,7 @@
                      absoluteURL(self.url, url))
 
     def xpath(self, expr, nsmap=None, single=False):
-        res = lxml.etree.fromstring(self.contents).xpath(expr, nsmap)
+        res = lxml.etree.fromstring(self.contents).xpath(expr, namespaces=nsmap)
         if not single:
             return res
         if len(res) != 1:

Modified: z3c.rest/trunk/src/z3c/rest/testing.py
===================================================================
--- z3c.rest/trunk/src/z3c/rest/testing.py	2008-03-06 07:51:19 UTC (rev 84499)
+++ z3c.rest/trunk/src/z3c/rest/testing.py	2008-03-06 08:02:14 UTC (rev 84500)
@@ -41,10 +41,7 @@
 
     def request(self, method, path, body, headers):
         # Extract the handle_error option header
-        if sys.version_info >= (2,5):
-            handleErrorsKey = 'X-Zope-Handle-Errors'
-        else:
-            handleErrorsKey = 'X-zope-handle-errors'
+        handleErrorsKey = 'x-zope-handle-errors'
         handleErrors = headers.get(handleErrorsKey, True)
         if handleErrorsKey in headers:
             del headers[handleErrorsKey]
@@ -88,7 +85,7 @@
     @apply
     def handleErrors():
         """See zope.testbrowser.interfaces.IBrowser"""
-        headerKey = 'X-Zope-Handle-Errors'
+        headerKey = 'x-zope-handle-errors'
 
         def get(self):
             return self.requestHeaders.get(headerKey, True)



More information about the Checkins mailing list