libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [01/14] git commit: Decouple Connection from the driver and don't require 'driver' attribute to be set.
Date Sat, 15 Jun 2013 06:28:11 GMT
Updated Branches:
  refs/heads/0.12.x 742d0832f -> 3e77f66bf
  refs/heads/trunk fe998bf6a -> 58ab7ae0b


Decouple Connection from the driver and don't require 'driver' attribute to be
set.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/873c1ee5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/873c1ee5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/873c1ee5

Branch: refs/heads/trunk
Commit: 873c1ee5993d7fdd4894685677187dc77b09a840
Parents: fe998bf
Author: Tomaz Muraus <tomaz@tomaz.me>
Authored: Fri Jun 14 22:13:40 2013 -0700
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Fri Jun 14 22:13:40 2013 -0700

----------------------------------------------------------------------
 libcloud/common/base.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/873c1ee5/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index c8eca27..4347e5e 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -485,10 +485,17 @@ class Connection(object):
         self.connection = connection
 
     def _user_agent(self):
-        return 'libcloud/%s (%s)%s' % (
+        user_agent_suffix = ' '.join(['(%s)' % x for x in self.ua])
+
+        if self.driver:
+            user_agent = 'libcloud/%s (%s) %s' % (
                   libcloud.__version__,
-                  self.driver.name,
-                  "".join([" (%s)" % x for x in self.ua]))
+                  self.driver.name, user_agent_suffix)
+        else:
+            user_agent = 'libcloud/%s %s' % (
+                  libcloud.__version__, user_agent_suffix)
+
+        return user_agent
 
     def user_agent_append(self, token):
         """


Mime
View raw message