Support conf from URL's with versions.

Adjusts our version match regex so that it detects URL's
which already have version's in them that start with
a '/'.

For example: '/v1'

Fixes LP Bug #992600.

Change-Id: I331e945c46757a01a4dd939b2098e68334b27530
This commit is contained in:
Dan Prince 2012-05-01 09:42:16 -04:00
parent c1053b233e
commit fb71028870
2 changed files with 10 additions and 1 deletions

View File

@ -50,7 +50,7 @@ LOG = logging.getLogger(__name__)
# common chunk size for get and put
CHUNKSIZE = 65536
VERSION_REGEX = re.compile(r"v[0-9\.]+")
VERSION_REGEX = re.compile(r"/?v[0-9\.]+")
def handle_unauthenticated(func):

View File

@ -2072,6 +2072,15 @@ class TestConfigureClientFromURL(unittest.TestCase):
self.assertEquals(use_ssl, self.client.use_ssl)
self.assertEquals(doc_root, self.client.doc_root)
def test_version_specified_in_url(self):
self.assertConfiguration(
url='http://www.example.com/v1',
host='www.example.com',
port=80,
use_ssl=False,
doc_root='/v1'
)
def test_no_port_no_ssl_no_doc_root(self):
self.assertConfiguration(
url='http://www.example.com',