mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#2211: properly document the Morsel behavior changes.
Also deprecate the undocumented set argument instead of removing it already in 3.5. Initial patch by Demian Brecht.
This commit is contained in:
parent
0deefd5a94
commit
1813c1701f
4 changed files with 55 additions and 12 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue