summaryrefslogtreecommitdiff
path: root/django/utils/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils/http.py')
-rw-r--r--django/utils/http.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/http.py b/django/utils/http.py
index 8bbafaedec..70bcbd90ac 100644
--- a/django/utils/http.py
+++ b/django/utils/http.py
@@ -253,6 +253,13 @@ def quote_etag(etag):
return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
+def unquote_etag(etag):
+ """
+ Unquote an ETag string; i.e. revert quote_etag().
+ """
+ return etag.strip('"').replace('\\"', '"').replace('\\\\', '\\') if etag else etag
+
+
def is_same_domain(host, pattern):
"""
Return ``True`` if the host is either an exact match or a match