summaryrefslogtreecommitdiff
path: root/swift/common/request_helpers.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2019-10-14 18:35:00 -0700
committerTim Burke <tim.burke@gmail.com>2020-01-29 12:56:58 -0800
commite3ee6ce31aed8d24fefdd20900d20688a12bb55d (patch)
tree7bd535d2708c52e05840f440270447682e44bb89 /swift/common/request_helpers.py
parent8efaa3556fdb21f741ff897dac4730c3c3654421 (diff)
downloadswift-e3ee6ce31aed8d24fefdd20900d20688a12bb55d.tar.gz
py38: cgi lost some names
Drive-by: always use quote=True; it basically never hurts. Change-Id: Id91fdd19f226e9ec0d9c702d40d041c385c52b88
Diffstat (limited to 'swift/common/request_helpers.py')
-rw-r--r--swift/common/request_helpers.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/swift/common/request_helpers.py b/swift/common/request_helpers.py
index 03d571f1f..e4ab41d3b 100644
--- a/swift/common/request_helpers.py
+++ b/swift/common/request_helpers.py
@@ -48,6 +48,15 @@ OBJECT_SYSMETA_CONTAINER_UPDATE_OVERRIDE_PREFIX = \
'x-object-sysmeta-container-update-override-'
+if six.PY2:
+ import cgi
+
+ def html_escape(s, quote=True):
+ return cgi.escape(s, quote=quote)
+else:
+ from html import escape as html_escape # noqa: F401
+
+
def get_param(req, name, default=None):
"""
Get parameters from an HTTP request ensuring proper handling UTF-8