Make sure msg(text=None) means that text should not be used (None must be converted to a string to send). Resolves #1077.

This commit is contained in:
Griatch 2016-10-02 21:51:15 +02:00
parent 2b35140fe3
commit 00c64b10bb
2 changed files with 5 additions and 1 deletions

View file

@ -71,7 +71,7 @@ class ContentsHandler(object):
pks = self._pkcache pks = self._pkcache
try: try:
return [self._idcache[pk] for pk in pks] return [self._idcache[pk] for pk in pks]
except KeyError, err: except KeyError:
# this can happen if the idmapper cache was cleared for an object # this can happen if the idmapper cache was cleared for an object
# in the contents cache. If so we need to re-initialize and try again. # in the contents cache. If so we need to re-initialize and try again.
self.init() self.init()

View file

@ -188,6 +188,10 @@ class SessionHandler(dict):
for key, data in kwargs.iteritems(): for key, data in kwargs.iteritems():
key = _validate(key) key = _validate(key)
if not data: if not data:
if key == "text":
# we don't allow sending text = None, this must mean
# that the text command is not to be used.
continue
rkwargs[key] = [ [], {} ] rkwargs[key] = [ [], {} ]
elif isinstance(data, dict): elif isinstance(data, dict):
rkwargs[key] = [ [], _validate(data) ] rkwargs[key] = [ [], _validate(data) ]