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:
parent
96ebe8d0f3
commit
861c722d30
2 changed files with 2 additions and 4 deletions
|
|
@ -585,9 +585,7 @@ class SubscriptionHandler(object):
|
||||||
for obj in self.all():
|
for obj in self.all():
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
try:
|
try:
|
||||||
if hasattr(obj, 'account'):
|
if hasattr(obj, 'account') and obj.account:
|
||||||
if not obj.account:
|
|
||||||
continue
|
|
||||||
obj = obj.account
|
obj = obj.account
|
||||||
if not obj.is_connected:
|
if not obj.is_connected:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -553,6 +553,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
obj.at_msg_send(text=text, to_obj=self, **kwargs)
|
obj.at_msg_send(text=text, to_obj=self, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log_trace()
|
logger.log_trace()
|
||||||
|
kwargs["options"] = options
|
||||||
try:
|
try:
|
||||||
if not self.at_msg_receive(text=text, **kwargs):
|
if not self.at_msg_receive(text=text, **kwargs):
|
||||||
# if at_msg_receive returns false, we abort message to this object
|
# if at_msg_receive returns false, we abort message to this object
|
||||||
|
|
@ -560,7 +561,6 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log_trace()
|
logger.log_trace()
|
||||||
|
|
||||||
kwargs["options"] = options
|
|
||||||
|
|
||||||
if text and not (isinstance(text, basestring) or isinstance(text, tuple)):
|
if text and not (isinstance(text, basestring) or isinstance(text, tuple)):
|
||||||
# sanitize text before sending across the wire
|
# sanitize text before sending across the wire
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue