Merge lp:~jkakar/txfluiddb/endpoint-trailing-slash into lp:txfluiddb

Proposed by Jamu Kakar
Status: Merged
Approved by: Tristan Seligmann
Approved revision: 12
Merged at revision: 12
Proposed branch: lp:~jkakar/txfluiddb/endpoint-trailing-slash
Merge into: lp:txfluiddb
Diff against target: 33 lines (+12/-0)
2 files modified
txfluiddb/client.py (+2/-0)
txfluiddb/test/test_client.py (+10/-0)
To merge this branch: bzr merge lp:~jkakar/txfluiddb/endpoint-trailing-slash
Reviewer Review Type Date Requested Status
Tristan Seligmann Approve
Review via email: mp+27457@code.launchpad.net

Description of the change

This branch introduces the following changes:

- A trailing slash is automatically appended to a base URL that
  doesn't have one when an Endpoint is instantiated.

To post a comment you must log in.
Revision history for this message
Terry Jones (terrycojones) wrote :

Looks fine to me. I'm of course not sure if Tristan will want this change. I also hit this problem once.

Revision history for this message
Tristan Seligmann (mithrandi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'txfluiddb/client.py'
2--- txfluiddb/client.py 2010-06-12 21:47:47 +0000
3+++ txfluiddb/client.py 2010-06-13 21:57:24 +0000
4@@ -428,6 +428,8 @@
5 if creds is not None and not isinstance(creds, BasicCreds):
6 raise ValueError('Only basic authentication is supported')
7
8+ if not baseURL.endswith("/"):
9+ baseURL = baseURL + "/"
10 self.baseURL = baseURL
11 self.version = version
12 self.creds = creds
13
14=== modified file 'txfluiddb/test/test_client.py'
15--- txfluiddb/test/test_client.py 2010-06-12 21:47:47 +0000
16+++ txfluiddb/test/test_client.py 2010-06-13 21:57:24 +0000
17@@ -570,6 +570,16 @@
18 self.assertEqual(endpoint.baseURL, url)
19
20
21+ def test_addTrailingSlash(self):
22+ """
23+ If the base URL doesn't have a trailing slash, one will be added
24+ automatically.
25+ """
26+ url = 'http://fluiddb.url'
27+ endpoint = Endpoint(url)
28+ self.assertEqual(endpoint.baseURL, 'http://fluiddb.url/')
29+
30+
31 def test_defaultEndpoint(self):
32 """
33 Endpoint defaults to the real, global FluidDB endpoint.

Subscribers

People subscribed via source and target branches

to all changes: