summaryrefslogtreecommitdiffstats
path: root/Lib/xml/dom/xmlbuilder.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/xml/dom/xmlbuilder.py')
-rw-r--r--Lib/xml/dom/xmlbuilder.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/Lib/xml/dom/xmlbuilder.py b/Lib/xml/dom/xmlbuilder.py
index d798624..444f0b2 100644
--- a/Lib/xml/dom/xmlbuilder.py
+++ b/Lib/xml/dom/xmlbuilder.py
@@ -1,6 +1,7 @@
"""Implementation of the DOM Level 3 'LS-Load' feature."""
import copy
+import warnings
import xml.dom
from xml.dom.NodeFilter import NodeFilter
@@ -331,13 +332,33 @@ class DOMBuilderFilter:
del NodeFilter
+class _AsyncDeprecatedProperty:
+ def warn(self, cls):
+ clsname = cls.__name__
+ warnings.warn(
+ "{cls}.async is deprecated; use {cls}.async_".format(cls=clsname),
+ DeprecationWarning)
+
+ def __get__(self, instance, cls):
+ self.warn(cls)
+ if instance is not None:
+ return instance.async_
+ return False
+
+ def __set__(self, instance, value):
+ self.warn(type(instance))
+ setattr(instance, 'async_', value)
+
+
class DocumentLS:
"""Mixin to create documents that conform to the load/save spec."""
- async = False
+ async = _AsyncDeprecatedProperty()
+ async_ = False
def _get_async(self):
return False
+
def _set_async(self, async):
if async:
raise xml.dom.NotSupportedErr(
@@ -363,6 +384,9 @@ class DocumentLS:
return snode.toxml()
+del _AsyncDeprecatedProperty
+
+
class DOMImplementationLS:
MODE_SYNCHRONOUS = 1
MODE_ASYNCHRONOUS = 2