issue #106: _unpickle_context() did not allow nameless contexts.

These are generated by any child calling .context_by_id() without
previously knowing the context's name, such as Contexts set in
ExternalContext.master and ExternalContext.parent.
pull/193/head
David Wilson 6 years ago
parent 17bfb596d0
commit 8f175bf7a8

@ -957,8 +957,10 @@ class Context(object):
def _unpickle_context(router, context_id, name):
if not (isinstance(router, Router) and
isinstance(context_id, (int, long)) and context_id >= 0 and
isinstance(name, basestring) and len(name) < 100):
isinstance(context_id, (int, long)) and context_id >= 0 and (
(name is None) or
(isinstance(name, basestring) and len(name) < 100))
):
raise TypeError('cannot unpickle Context: bad input')
return router.context_class(router, context_id, name)

Loading…
Cancel
Save