Change if statement to better handle objects; move options dict before at_msg_receive call to allow channels to be known in hook

This commit is contained in:
Nicholas Matlaga 2018-02-13 12:49:55 -05:00
parent 827b7214cd
commit 11c9d60111
2 changed files with 2 additions and 4 deletions

View file

@ -584,9 +584,7 @@ class SubscriptionHandler(object):
for obj in self.all():
from django.core.exceptions import ObjectDoesNotExist
try:
if hasattr(obj, 'account'):
if not obj.account:
continue
if hasattr(obj, 'account') and obj.account:
obj = obj.account
if not obj.is_connected:
continue

View file

@ -519,6 +519,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
obj.at_msg_send(text=text, to_obj=self, **kwargs)
except Exception:
logger.log_trace()
kwargs["options"] = options
try:
if not self.at_msg_receive(text=text, **kwargs):
# if at_msg_receive returns false, we abort message to this object
@ -526,7 +527,6 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
except Exception:
logger.log_trace()
kwargs["options"] = options
if text and not (isinstance(text, basestring) or isinstance(text, tuple)):
# sanitize text before sending across the wire