You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/09/13 12:38:42 UTC

[1/3] git commit: Use string instead of number for RecordType enum value and get rid of nasty __repr__ hack.

Updated Branches:
  refs/heads/use_string_for_record_type_value [created] 8475777c9


Use string instead of number for RecordType enum value and get rid of nasty
__repr__ hack.


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

Branch: refs/heads/use_string_for_record_type_value
Commit: cd5ab5457535d606c1c0fc22e0593a0a1eaa7b26
Parents: 74c05d0
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Sep 12 19:36:28 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Sep 12 19:36:28 2013 +0200

----------------------------------------------------------------------
 libcloud/dns/base.py          |  4 ++--
 libcloud/dns/drivers/dummy.py |  2 +-
 libcloud/dns/types.py         | 26 ++++++++++++++++++++++----
 3 files changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5ab545/libcloud/dns/base.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/base.py b/libcloud/dns/base.py
index a6d5384..a80ea98 100644
--- a/libcloud/dns/base.py
+++ b/libcloud/dns/base.py
@@ -120,8 +120,8 @@ class Record(object):
     def __repr__(self):
         return ('<Record: zone=%s, name=%s, type=%s, data=%s, provider=%s '
                 '...>' %
-                (self.zone.id, self.name, RecordType.__repr__(self.type),
-                 self.data, self.driver.name))
+                (self.zone.id, self.name, self.type, self.data,
+                 self.driver.name))
 
 
 class DNSDriver(BaseDriver):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5ab545/libcloud/dns/drivers/dummy.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/dummy.py b/libcloud/dns/drivers/dummy.py
index f1352f5..4b8117a 100644
--- a/libcloud/dns/drivers/dummy.py
+++ b/libcloud/dns/drivers/dummy.py
@@ -49,7 +49,7 @@ class DummyDNSDriver(DNSDriver):
         """
         >>> driver = DummyDNSDriver('key', 'secret')
         >>> driver.list_record_types()
-        [0]
+        ['A']
 
         @inherits: L{DNSDriver.list_record_types}
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5ab545/libcloud/dns/types.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/types.py b/libcloud/dns/types.py
index 7acb1e4..e71548c 100644
--- a/libcloud/dns/types.py
+++ b/libcloud/dns/types.py
@@ -61,10 +61,28 @@ class RecordType(object):
     WKS = 16
     LOC = 17
 
-    @classmethod
-    def __repr__(self, value):
-        reverse = dict((v, k) for k, v in list(RecordType.__dict__.items()))
-        return reverse[value]
+class RecordType(object):
+    """
+    DNS record type.
+    """
+    A = 'A'
+    AAAA = 'AAAA'
+    MX = 'MX'
+    NS = 'NS'
+    CNAME = 'CNAME'
+    DNAME = 'DNAME'
+    TXT = 'TXT'
+    PTR = 'PTR'
+    SOA = 'SOA'
+    SPF = 'SPF'
+    SRV = 'SRV'
+    PTR = 'PTR'
+    NAPTR = 'NAPTR'
+    REDIRECT = 'REDIRECT'
+    GEO = 'GEO'
+    URL = 'URL'
+    WKS = 'WKS'
+    LOC = 'LOC'
 
 
 class ZoneError(LibcloudError):


[3/3] git commit: Update changes.

Posted by to...@apache.org.
Update changes.


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

Branch: refs/heads/use_string_for_record_type_value
Commit: 8475777c92756be18dacc2dca352747de732175b
Parents: 58ee25b
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Sep 13 12:38:21 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Sep 13 12:38:21 2013 +0200

----------------------------------------------------------------------
 CHANGES | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8475777c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b0bd736..b383f21 100644
--- a/CHANGES
+++ b/CHANGES
@@ -114,6 +114,12 @@ Changes with Apache Libcloud in development
      the provided key is not set.
      [Tomaz Muraus]
 
+   - Use string instead of integer for RecordType ENUM value.
+     Note: If you directly use an integer instead of RecordType ENUM class you
+     need to update your code to use the RecordType ENUM otherwise the code
+     won't work.
+     [Tomaz Muraus]
+
 Changes with Apache Libcloud 0.13.1
 
  *) General


[2/3] git commit: Remove old RecordType definition.

Posted by to...@apache.org.
Remove old RecordType definition.


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

Branch: refs/heads/use_string_for_record_type_value
Commit: 58ee25b5d8f6bf35743c2d5e4f4441fc5f241d04
Parents: cd5ab54
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Sep 12 19:48:38 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Sep 12 19:48:38 2013 +0200

----------------------------------------------------------------------
 libcloud/dns/types.py | 23 -----------------------
 1 file changed, 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/58ee25b5/libcloud/dns/types.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/types.py b/libcloud/dns/types.py
index e71548c..4698e5f 100644
--- a/libcloud/dns/types.py
+++ b/libcloud/dns/types.py
@@ -42,29 +42,6 @@ class RecordType(object):
     """
     DNS record type.
     """
-    A = 0
-    AAAA = 1
-    MX = 2
-    NS = 3
-    CNAME = 4
-    DNAME = 5
-    TXT = 6
-    PTR = 7
-    SOA = 8
-    SPF = 9
-    SRV = 10
-    PTR = 11
-    NAPTR = 12
-    REDIRECT = 13
-    GEO = 14
-    URL = 15
-    WKS = 16
-    LOC = 17
-
-class RecordType(object):
-    """
-    DNS record type.
-    """
     A = 'A'
     AAAA = 'AAAA'
     MX = 'MX'