summaryrefslogtreecommitdiff
path: root/dns/versioned.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-08-13 07:31:57 -0700
committerBob Halley <halley@dnspython.org>2020-08-13 07:31:57 -0700
commit677c3c03c91d5d758e2f7a225a7455d9b2b5da24 (patch)
tree7c99f2cab49a467ba78bb912d5a7c5f148407885 /dns/versioned.py
parent060ad0db51fbb26a6f809548d884ef468ad06beb (diff)
downloaddnspython-677c3c03c91d5d758e2f7a225a7455d9b2b5da24.tar.gz
Allow explicit commit/rollback. Prevent multiple txn end. Add txn.changed().
Diffstat (limited to 'dns/versioned.py')
-rw-r--r--dns/versioned.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/dns/versioned.py b/dns/versioned.py
index e753438..e070c1a 100644
--- a/dns/versioned.py
+++ b/dns/versioned.py
@@ -90,6 +90,7 @@ class WritableVersion(Version):
name = self._validate_name(name)
if name in self.nodes:
del self.nodes[name]
+ self.changed.add(name)
return True
return False
@@ -436,6 +437,12 @@ class Transaction(dns.transaction.Transaction):
def _name_exists(self, name):
return self.version.get_node(name) is not None
+ def _changed(self):
+ if self.read_only:
+ return False
+ else:
+ return len(self.version.changed) > 0
+
def _end_transaction(self, commit):
if self.read_only:
self.zone._end_read(self)