mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 05:16:31 +01:00
Made property assignment go to Typeclass if that property were already defined on typeclass; otherwise relegate to dbobj as before. This fixes issues with property assignments on the Typeclass level. There are no obvious regressions in testing this but it's something to keep an eye out for in case there are any unexpected side effects.
This commit is contained in:
parent
348ff0b5f4
commit
5b38f27554
2 changed files with 18 additions and 15 deletions
|
|
@ -242,13 +242,12 @@ class Command(object):
|
|||
if hasattr(to_obj, "sessid"):
|
||||
# this is the case when to_obj is e.g. a Character
|
||||
toobj_sessions = to_obj.sessid.get()
|
||||
|
||||
|
||||
# If to_obj has more than one session MULTISESSION_MODE=3
|
||||
# we need to send to every session.
|
||||
# we need to send to every session.
|
||||
#(setting it to None, does it)
|
||||
if len(toobj_sessions)>1:
|
||||
session_tosend=None
|
||||
else:
|
||||
session_tosend = None
|
||||
if len(toobj_sessions) == 1:
|
||||
session_tosend=toobj_sessions[0]
|
||||
sessid = all_sessions and None or session_tosend
|
||||
elif to_obj == self.caller:
|
||||
|
|
|
|||
|
|
@ -119,8 +119,9 @@ class TypeClass(object):
|
|||
|
||||
def __setattr__(self, propname, value):
|
||||
"""
|
||||
Transparently save data to the dbobj object in
|
||||
all situations. Note that this does not
|
||||
Transparently save data. Use property on Typeclass only if
|
||||
that property is already defined, otherwise relegate to the
|
||||
dbobj object in all situations. Note that this does not
|
||||
necessarily mean storing it to the database.
|
||||
"""
|
||||
#print "set %s -> %s" % (propname, value)
|
||||
|
|
@ -130,15 +131,18 @@ class TypeClass(object):
|
|||
log_errmsg(string % (self.name, propname))
|
||||
return
|
||||
try:
|
||||
dbobj = _GA(self, 'dbobj')
|
||||
except AttributeError:
|
||||
dbobj = None
|
||||
log_trace("This is probably due to an unsafe reload.")
|
||||
if dbobj:
|
||||
_SA(dbobj, propname, value)
|
||||
else:
|
||||
# only as a last resort do we save on the typeclass object
|
||||
_GA(self, propname)
|
||||
_SA(self, propname, value)
|
||||
except AttributeError:
|
||||
try:
|
||||
dbobj = _GA(self, 'dbobj')
|
||||
except AttributeError:
|
||||
dbobj = None
|
||||
if dbobj:
|
||||
_SA(dbobj, propname, value)
|
||||
else:
|
||||
# only as a last resort do we save on the typeclass object
|
||||
_SA(self, propname, value)
|
||||
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue