diff --git a/django/core/serializers/xml_serializer.py b/django/core/serializers/xml_serializer.py
index 910c489a377b..a9fe3cf01d2d 100644
--- a/django/core/serializers/xml_serializer.py
+++ b/django/core/serializers/xml_serializer.py
@@ -416,27 +416,17 @@ def _get_model_from_node(self, node, attr):
def getInnerText(node):
- """Get all the inner text of a DOM node (recursively)."""
- inner_text_list = getInnerTextList(node)
- return "".join(inner_text_list)
-
-
-def getInnerTextList(node):
- """Return a list of the inner texts of a DOM node (recursively)."""
+ """Get the inner text of a DOM node and any children one level deep."""
# inspired by
# https://mail.python.org/pipermail/xml-sig/2005-March/011022.html
- result = []
- for child in node.childNodes:
- if (
- child.nodeType == child.TEXT_NODE
- or child.nodeType == child.CDATA_SECTION_NODE
- ):
- result.append(child.data)
- elif child.nodeType == child.ELEMENT_NODE:
- result.extend(getInnerTextList(child))
- else:
- pass
- return result
+ return "".join(
+ [
+ element.data
+ for child in node.childNodes
+ for element in (child, *child.childNodes)
+ if element.nodeType in (element.TEXT_NODE, element.CDATA_SECTION_NODE)
+ ]
+ )
# Below code based on Christian Heimes' defusedxml
diff --git a/docs/howto/auth-remote-user.txt b/docs/howto/auth-remote-user.txt
index c5f53c5e071b..533f460e4ac4 100644
--- a/docs/howto/auth-remote-user.txt
+++ b/docs/howto/auth-remote-user.txt
@@ -111,7 +111,7 @@ instead of :class:`django.contrib.auth.middleware.RemoteUserMiddleware`::
This warning doesn't apply to ``RemoteUserMiddleware`` in its default
configuration with ``header = 'REMOTE_USER'``, since a key that doesn't
start with ``HTTP_`` in ``request.META`` can only be set by your WSGI
- server, not directly from an HTTP request header.
+ or ASGI server, not directly from an HTTP request header.
If you need more control, you can create your own authentication backend
that inherits from :class:`~django.contrib.auth.backends.RemoteUserBackend` and
diff --git a/docs/internals/_images/contribution_process.pdf b/docs/internals/_images/contribution_process.pdf
new file mode 100644
index 000000000000..19378575f0a6
Binary files /dev/null and b/docs/internals/_images/contribution_process.pdf differ
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index 9a6b14ef4c15..961e4548325a 100644
--- a/docs/ref/contrib/contenttypes.txt
+++ b/docs/ref/contrib/contenttypes.txt
@@ -181,8 +181,16 @@ The ``ContentTypeManager``
:class:`~django.contrib.contenttypes.models.ContentType` to keep track
of models for which it has created
:class:`~django.contrib.contenttypes.models.ContentType` instances. You
- probably won't ever need to call this method yourself; Django will call
- it automatically when it's needed.
+ probably won't need to call this method in application code yourself;
+ Django will call it automatically when it's needed.
+
+ You may need to clear the cache when testing, to reset between tests,
+ or after preparing test state. For example::
+
+ class ContentTypesTests(TestCase):
+ def setUp(self):
+ ContentType.objects.clear_cache()
+ self.addCleanup(ContentType.objects.clear_cache)
.. method:: get_for_id(id)
diff --git a/docs/ref/contrib/postgres/aggregates.txt b/docs/ref/contrib/postgres/aggregates.txt
index 1825ec2fc504..0ca144bb6623 100644
--- a/docs/ref/contrib/postgres/aggregates.txt
+++ b/docs/ref/contrib/postgres/aggregates.txt
@@ -182,6 +182,9 @@ General-purpose aggregation functions
.. deprecated:: 6.0
+ The PostgreSQL ``StringAgg`` class is deprecated in favor of the
+ generally available :class:`~django.db.models.StringAgg` class.
+
Returns the input values concatenated into a string, separated by
the ``delimiter`` string, or ``default`` if there are no values.
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 5a2696993c0b..1f3e27414129 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -1058,7 +1058,7 @@ Methods
.. method:: HttpResponse.close()
This method is called at the end of the request directly by the WSGI
- server.
+ or ASGI server.
.. method:: HttpResponse.write(content)
diff --git a/tests/fixtures/fixtures/invalid_deeply_nested_elements.xml b/tests/fixtures/fixtures/invalid_deeply_nested_elements.xml
new file mode 100644
index 000000000000..cd164d3d2601
--- /dev/null
+++ b/tests/fixtures/fixtures/invalid_deeply_nested_elements.xml
@@ -0,0 +1,10 @@
+
+
See: 'é is an apostrophe followed by e acute
", @@ -156,16 +168,19 @@ def test_strip_tags(self): # https://bugs.python.org/issue20288 ("&gotcha<>", "&gotcha<>"), ("