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 2011/10/08 11:24:13 UTC
svn commit: r1180339 - in /libcloud/trunk/libcloud/dns: base.py
drivers/linode.py
Author: tomaz
Date: Sat Oct 8 09:24:13 2011
New Revision: 1180339
URL: http://svn.apache.org/viewvc?rev=1180339&view=rev
Log:
Make extra the last argument since it's optional.
Modified:
libcloud/trunk/libcloud/dns/base.py
libcloud/trunk/libcloud/dns/drivers/linode.py
Modified: libcloud/trunk/libcloud/dns/base.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/dns/base.py?rev=1180339&r1=1180338&r2=1180339&view=diff
==============================================================================
--- libcloud/trunk/libcloud/dns/base.py (original)
+++ libcloud/trunk/libcloud/dns/base.py Sat Oct 8 09:24:13 2011
@@ -29,7 +29,7 @@ class Zone(object):
DNS zone.
"""
- def __init__(self, id, domain, type, ttl, extra, driver):
+ def __init__(self, id, domain, type, ttl, driver, extra=None):
"""
@type id: C{str}
@param id: Zone id.
@@ -43,18 +43,18 @@ class Zone(object):
@type ttl: C{int}
@param ttl: Default TTL for records in this zone (in seconds).
- @type extra: C{dict}
- @param extra: (optional) Extra attributes (driver specific).
-
@type driver: C{DNSDriver}
@param driver: DNSDriver instance.
+
+ @type extra: C{dict}
+ @param extra: (optional) Extra attributes (driver specific).
"""
self.id = str(id) if id else None
self.domain = domain
self.type = type
self.ttl = ttl or None
- self.extra = extra or {}
self.driver = driver
+ self.extra = extra or {}
def list_records(self):
self.driver.list_records(zone=self)
@@ -79,7 +79,7 @@ class Record(object):
Zone record / resource.
"""
- def __init__(self, id, name, type, data, extra, zone, driver):
+ def __init__(self, id, name, type, data, zone, driver, extra=None):
"""
@type id: C{str}
@param id: Record id
@@ -93,22 +93,22 @@ class Record(object):
@type data: C{str}
@param data: Data for the record (depends on the record type).
- @type extra: C{dict}
- @param extra: (optional) Extra attributes (driver specific).
-
@type zone: C{Zone}
@param zone: Zone instance.
@type driver: C{DNSDriver}
@param driver: DNSDriver instance.
+
+ @type extra: C{dict}
+ @param extra: (optional) Extra attributes (driver specific).
"""
self.id = str(id) if id else None
self.name = name
self.type = type
self.data = data
- self.extra = extra or {}
self.zone = zone
self.driver = driver
+ self.extra = extra or {}
def update(self, name, type, data, extra):
return self.driver.update_record(record=self, name=name, type=type,
Modified: libcloud/trunk/libcloud/dns/drivers/linode.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/dns/drivers/linode.py?rev=1180339&r1=1180338&r2=1180339&view=diff
==============================================================================
--- libcloud/trunk/libcloud/dns/drivers/linode.py (original)
+++ libcloud/trunk/libcloud/dns/drivers/linode.py Sat Oct 8 09:24:13 2011
@@ -239,8 +239,8 @@ class LinodeDNSDriver(DNSDriver):
extra = {'SOA_Email': item['SOA_EMAIL'], 'status': item['STATUS'],
'description': item['DESCRIPTION']}
zone = Zone(id=item['DOMAINID'], domain=item['DOMAIN'],
- type=item['TYPE'], ttl=item['TTL_SEC'], extra=extra,
- driver=self)
+ type=item['TYPE'], ttl=item['TTL_SEC'], driver=self,
+ extra=extra)
return zone
def _to_records(self, items, zone=None):
@@ -262,6 +262,6 @@ class LinodeDNSDriver(DNSDriver):
'port': item['PORT'], 'weight': item['WEIGHT']}
type = self._string_to_record_type(item['TYPE'])
record = Record(id=item['RESOURCEID'], name=item['NAME'], type=type,
- data=item['TARGET'], extra=extra, zone=zone,
- driver=self)
+ data=item['TARGET'], zone=zone, driver=self,
+ extra=extra)
return record