Updated Branches:
  refs/heads/trunk 0814ed690 -> 6791d030a

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/trunk
Commit: cd5ab5457535d606c1c0fc22e0593a0a1eaa7b26
Parents: 74c05d0
Author: Tomaz Muraus <[email protected]>
Authored: Thu Sep 12 19:36:28 2013 +0200
Committer: Tomaz Muraus <[email protected]>
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):

Reply via email to