[Checkins] SVN: z3c.rest/trunk/ Fix a bug and get ready for release.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Mar 19 19:51:04 EDT 2008


Log message for revision 84794:
  Fix a bug and get ready for release.
  

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

-=-
Modified: z3c.rest/trunk/CHANGES.txt
===================================================================
--- z3c.rest/trunk/CHANGES.txt	2008-03-19 21:27:34 UTC (rev 84793)
+++ z3c.rest/trunk/CHANGES.txt	2008-03-19 23:51:03 UTC (rev 84794)
@@ -2,6 +2,14 @@
 CHANGES
 =======
 
+0.2.2 (2008-03-19)
+------------------
+
+- Bug/Misfeature: The client always added a slash to the end of the URL. But
+  some REST APIs are very sensitive to this. Now the slash is only preserved
+  if present, but nothing will be added otherwise.
+
+
 0.2.1 (2008-03-06)
 ------------------
 

Modified: z3c.rest/trunk/setup.py
===================================================================
--- z3c.rest/trunk/setup.py	2008-03-19 21:27:34 UTC (rev 84793)
+++ z3c.rest/trunk/setup.py	2008-03-19 23:51:03 UTC (rev 84794)
@@ -31,7 +31,7 @@
 
 setup (
     name='z3c.rest',
-    version='0.2.2dev',
+    version='0.2.2',
     author = "Stephan Richter and the Zope Community",
     author_email = "zope3-dev at zope.org",
     description = "A REST Framework for Zope 3 Applications",

Modified: z3c.rest/trunk/src/z3c/rest/client.py
===================================================================
--- z3c.rest/trunk/src/z3c/rest/client.py	2008-03-19 21:27:34 UTC (rev 84793)
+++ z3c.rest/trunk/src/z3c/rest/client.py	2008-03-19 23:51:03 UTC (rev 84794)
@@ -41,7 +41,11 @@
     pieces = list(urlparse.urlparse(fullUrl))
     if not pieces[2].endswith('/'):
         pieces[2] += '/'
-    return urlparse.urlunparse(pieces)
+    newUrl = urlparse.urlunparse(pieces)
+    # Some systems really do not like the trailing /
+    if not url.endswith('/') and newUrl.endswith('/'):
+        newUrl = newUrl[:-1]
+    return newUrl
 
 def getFullPath(pieces, params):
     """Build a full httplib request path, including a query string."""

Modified: z3c.rest/trunk/src/z3c/rest/client.txt
===================================================================
--- z3c.rest/trunk/src/z3c/rest/client.txt	2008-03-19 21:27:34 UTC (rev 84793)
+++ z3c.rest/trunk/src/z3c/rest/client.txt	2008-03-19 23:51:03 UTC (rev 84794)
@@ -216,7 +216,7 @@
   >>> client.get('folder1')
 
   >>> client.url
-  'http://localhost/folder1/'
+  'http://localhost/folder1'
 
   >>> print client.contents
   <?xml version="1.0" ?>
@@ -384,13 +384,13 @@
 bit -- we can also use the ``getLink()`` method to access links:
 
   >>> client.getLink('folder1')
-  <XLink title='folder1' url='http://localhost/folder1/'>
+  <XLink title='folder1' url='http://localhost/folder1'>
 
 By default, the link is looked up by title. But you can also look it up by
 URL:
 
   >>> client.getLink(url='http://localhost/folder1')
-  <XLink title='folder1' url='http://localhost/folder1/'>
+  <XLink title='folder1' url='http://localhost/folder1'>
 
 If you forget to specify a title or URL, you receive a ``ValueError``:
 
@@ -407,7 +407,7 @@
   >>> client.getLink('folder1').click()
 
   >>> client.url
-  'http://localhost/folder1/'
+  'http://localhost/folder1'
 
 
 Moving through time
@@ -417,7 +417,7 @@
 currently we are looking at `folder1`, ...
 
   >>> client.url
-  'http://localhost/folder1/'
+  'http://localhost/folder1'
 
 but if I go back one step, I am back at the root folder:
 
@@ -497,7 +497,7 @@
   >>> client.goBack(0)
 
   >>> client.url
-  'http://localhost/folder1/'
+  'http://localhost/folder1'
 
 Also, if you try to go back beyond the beginning of time, a value error is
 raised:



More information about the Checkins mailing list