#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:
R David Murray 2015-03-29 17:09:21 -04:00
parent 0deefd5a94
commit 1813c1701f
4 changed files with 55 additions and 12 deletions

View file

@ -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):