mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 18:26:32 +01:00
Merge pull request #1571 from chainsol/fix_#1570
Change if statement in comms/models.py to fix #1570
This commit is contained in:
commit
2307c67294
2 changed files with 10 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -206,6 +206,14 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
|||
def sessions(self):
|
||||
return ObjectSessionHandler(self)
|
||||
|
||||
@property
|
||||
def is_connected(self):
|
||||
# we get an error for objects subscribed to channels without this
|
||||
if self.account: # seems sane to pass on the account
|
||||
return self.account.is_connected
|
||||
else:
|
||||
return False
|
||||
|
||||
@property
|
||||
def has_account(self):
|
||||
"""
|
||||
|
|
@ -519,6 +527,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 +535,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue