Add a comment, use a better variable name.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e1c634d0 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e1c634d0 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e1c634d0 Branch: refs/heads/trunk Commit: e1c634d03eae0261b4a71cf5cb4693de13f9fdf4 Parents: 34c3df4 Author: Tomaz Muraus <[email protected]> Authored: Thu Jan 30 17:23:37 2014 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Thu Jan 30 17:24:02 2014 +0100 ---------------------------------------------------------------------- libcloud/storage/drivers/cloudfiles.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/e1c634d0/libcloud/storage/drivers/cloudfiles.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index 8abaa1f..c3ce0b5 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -52,6 +52,8 @@ from libcloud.common.rackspace import AUTH_URL CDN_HOST = 'cdn.clouddrive.com' API_VERSION = 'v1.0' + +# Keys which are used to select a correct endpoint from the service catalog. INTERNAL_ENDPOINT_KEY = 'internalURL' PUBLIC_ENDPOINT_KEY = 'publicURL' @@ -119,6 +121,7 @@ class CloudFilesConnection(OpenStackBaseConnection): def _get_endpoint_key(self): endpoint_key = INTERNAL_ENDPOINT_KEY if self.use_internal_url else PUBLIC_ENDPOINT_KEY + if self.cdn_request: endpoint_key = PUBLIC_ENDPOINT_KEY # cdn endpoints don't have internal urls return endpoint_key @@ -142,13 +145,14 @@ class CloudFilesConnection(OpenStackBaseConnection): # if this is a CDN request, return the cdn url instead if self.cdn_request: ep = cdn_ep - endpoint_url = self._get_endpoint_key() + + endpoint_key = self._get_endpoint_key() if not ep: raise LibcloudError('Could not find specified endpoint') - if endpoint_url in ep: - return ep[endpoint_url] + if endpoint_key in ep: + return ep[endpoint_key] else: raise LibcloudError('Could not find specified endpoint')
