Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor tweaks to deletion protection.

  • Loading branch information...
commit 0b1bc6fb4122d3a0934a4e07366f9164b6453e57 1 parent f2a22d1
@gtaylor authored
Showing with 15 additions and 5 deletions.
  1. +13 −4 route53/hosted_zone.py
  2. +2 −1  route53/resource_record_set.py
View
17 route53/hosted_zone.py
@@ -91,8 +91,7 @@ def delete(self, force=False):
the request.
"""
- if self._is_deleted:
- raise AlreadyDeletedError('HostedZone is already deleted.')
+ self._halt_if_already_deleted()
if force:
# Forcing deletion by cleaning up all record sets first. We'll
@@ -117,6 +116,17 @@ def delete(self, force=False):
return retval
+ def _halt_if_already_deleted(self):
+ """
+ Convenience method used to raise an AlreadyDeletedError exception if
+ this HostedZone has been deleted.
+
+ :raises: AlreadyDeletedError
+ """
+
+ if self._is_deleted:
+ raise AlreadyDeletedError("Can't manipulate a deleted zone.")
+
def add_a_record(self, name, values, ttl=60):
"""
Adds an A record to the hosted zone.
@@ -129,8 +139,7 @@ def add_a_record(self, name, values, ttl=60):
``rrset`` is the newly created AResourceRecordSet instance.
"""
- if self._is_deleted:
- raise AlreadyDeletedError("Can't add records to a deleted HostedZone.")
+ self._halt_if_already_deleted()
rrset = AResourceRecordSet(
connection=self.connection,
View
3  route53/resource_record_set.py
@@ -58,7 +58,8 @@ def hosted_zone(self):
def is_modified(self):
"""
- Determines whether this record set has been modified since retrieval.
+ Determines whether this record set has been modified since the
+ last retrieval or save.
:rtype: bool
:returns: ``True` if the record set has been modified,
Please sign in to comment.
Something went wrong with that request. Please try again.