summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/http/cookies.py9
-rw-r--r--Lib/test/test_http_cookies.py2
2 files changed, 10 insertions, 1 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py
index 98489fb..26c9ac4 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -366,7 +366,14 @@ class Morsel(dict):
def isReservedKey(self, K):
return K.lower() in self._reserved
- def set(self, key, val, coded_val):
+ def set(self, key, val, coded_val, LegalChars=_LegalChars):
+ if LegalChars != _LegalChars:
+ import warnings
+ warnings.warn(
+ 'LegalChars parameter is deprecated, ignored and will '
+ 'be removed in future versions.', DeprecationWarning,
+ stacklevel=2)
+
if key.lower() in self._reserved:
raise CookieError('Attempt to set a reserved key %r' % (key,))
if not _is_legal_key(key):
diff --git a/Lib/test/test_http_cookies.py b/Lib/test/test_http_cookies.py
index 5f1e74b..cf0f6b9 100644
--- a/Lib/test/test_http_cookies.py
+++ b/Lib/test/test_http_cookies.py
@@ -261,6 +261,8 @@ class MorselTests(unittest.TestCase):
morsel.value = ''
with self.assertWarnsRegex(DeprecationWarning, r'\bcoded_value\b'):
morsel.coded_value = ''
+ with self.assertWarnsRegex(DeprecationWarning, r'\bLegalChars\b'):
+ morsel.set('key', 'value', 'coded_value', LegalChars='.*')
def test_eq(self):
base_case = ('key', 'value', '"value"')