Code

Ticket #3094: XMLField_deprecation.diff

File XMLField_deprecation.diff, 5.6 KB (added by PaulM, 3 years ago)
Line 
1Index: docs/internals/deprecation.txt
2===================================================================
3--- docs/internals/deprecation.txt      (revision 15652)
4+++ docs/internals/deprecation.txt      (working copy)
5@@ -41,9 +41,10 @@
6           removed.
7 
8         * The ``get_db_prep_save``, ``get_db_prep_value`` and
9-          ``get_db_prep_lookup`` methods on Field were modified in 1.2 to support
10-          multiple databases. In 1.4, the support functions that allow methods
11-          with the old prototype to continue working will be removed.
12+          ``get_db_prep_lookup`` methods on Field were modified in 1.2
13+          to support multiple databases. In 1.4, the support functions
14+          that allow methods with the old prototype to continue
15+          working will be removed.
16 
17         * The ``Message`` model (in ``django.contrib.auth``), its related
18           manager in the ``User`` model (``user.message_set``), and the
19@@ -105,6 +106,10 @@
20           with a trailing slash to ensure there is a consistent way to
21           combine paths in templates.
22 
23+       * ``XMLField`` was deprecated in 1.3 and will be removed in
24+          1.4. This accelerated process was chosen since the field
25+          hasn't worked properly since oldforms was removed.
26+
27     * 1.5
28         * The ``mod_python`` request handler has been deprecated since the 1.3
29           release. The ``mod_wsgi`` handler should be used instead.
30Index: docs/topics/forms/modelforms.txt
31===================================================================
32--- docs/topics/forms/modelforms.txt    (revision 15652)
33+++ docs/topics/forms/modelforms.txt    (working copy)
34@@ -106,9 +106,6 @@
35 
36     ``URLField``                     ``URLField`` with ``verify_exists`` set
37                                      to the model field's ``verify_exists``
38-
39-    ``XMLField``                     ``CharField`` with
40-                                     ``widget=forms.Textarea``
41     ===============================  ========================================
42 
43 .. versionadded:: 1.2
44Index: docs/ref/models/fields.txt
45===================================================================
46--- docs/ref/models/fields.txt  (revision 15652)
47+++ docs/ref/models/fields.txt  (working copy)
48@@ -836,17 +836,18 @@
49 ``XMLField``
50 ------------
51 
52+.. versionchanged:: 1.3
53+   ``XMLField`` is deprecated. Use TextField instead.
54+
55 .. class:: XMLField(schema_path=None, [**options])
56 
57-A :class:`TextField` that checks that the value is valid XML that matches a
58-given schema. Takes one required argument:
59+A :class:`TextField` that stores XML data and a path to a schema. Takes one
60+optional argument:
61 
62 .. attribute:: schema_path
63 
64-    The filesystem path to a RelaxNG_ schema against which to validate the
65-    field.
66+    The filesystem path to a schema for the field.
67 
68-.. _RelaxNG: http://www.relaxng.org/
69 
70 Relationship fields
71 ===================
72Index: tests/regressiontests/serializers_regress/tests.py
73===================================================================
74--- tests/regressiontests/serializers_regress/tests.py  (revision 15652)
75+++ tests/regressiontests/serializers_regress/tests.py  (working copy)
76@@ -222,9 +222,6 @@
77     (data_obj, 180, USStateData, "MA"),
78     (data_obj, 181, USStateData, None),
79     (data_obj, 182, USStateData, ""),
80-    (data_obj, 190, XMLData, "<foo></foo>"),
81-    (data_obj, 191, XMLData, None),
82-    (data_obj, 192, XMLData, ""),
83 
84     (generic_obj, 200, GenericData, ['Generic Object 1', 'tag1', 'tag2']),
85     (generic_obj, 201, GenericData, ['Generic Object 2', 'tag2', 'tag3']),
86Index: tests/regressiontests/serializers_regress/models.py
87===================================================================
88--- tests/regressiontests/serializers_regress/models.py (revision 15652)
89+++ tests/regressiontests/serializers_regress/models.py (working copy)
90@@ -79,9 +79,6 @@
91 class USStateData(models.Model):
92     data = USStateField(null=True)
93 
94-class XMLData(models.Model):
95-    data = models.XMLField(null=True)
96-
97 class Tag(models.Model):
98     """A tag on an item."""
99     data = models.SlugField()
100@@ -218,9 +215,6 @@
101 class USStatePKData(models.Model):
102     data = USStateField(primary_key=True)
103 
104-# class XMLPKData(models.Model):
105-#     data = models.XMLField(primary_key=True)
106-
107 class ComplexModel(models.Model):
108     field1 = models.CharField(max_length=10)
109     field2 = models.CharField(max_length=10)
110Index: django/db/models/fields/__init__.py
111===================================================================
112--- django/db/models/fields/__init__.py (revision 15652)
113+++ django/db/models/fields/__init__.py (working copy)
114@@ -1136,6 +1136,10 @@
115     description = _("XML text")
116 
117     def __init__(self, verbose_name=None, name=None, schema_path=None, **kwargs):
118+        import warnings
119+        warnings.warn("XMLField is deprecated, please migrate to "
120+                      "TextField for equivalent functionality",
121+                      DeprecationWarning)
122         self.schema_path = schema_path
123         Field.__init__(self, verbose_name, name, **kwargs)
124 
125Index: django/contrib/gis/utils/layermapping.py
126===================================================================
127--- django/contrib/gis/utils/layermapping.py    (revision 15652)
128+++ django/contrib/gis/utils/layermapping.py    (working copy)
129@@ -54,6 +54,8 @@
130         models.TextField : OFTString,
131         models.URLField : OFTString,
132         USStateField : OFTString,
133+        #This is a reminder that XMLField is deprecated
134+        # and this needs to be removed in 1.4
135         models.XMLField : OFTString,
136         models.SmallIntegerField : (OFTInteger, OFTReal, OFTString),
137         models.PositiveSmallIntegerField : (OFTInteger, OFTReal, OFTString),