mirror of
https://github.com/evennia/evennia.git
synced 2026-04-02 14:07:16 +02:00
Reverting metaclass wrapper for db_key, will have to look into why it behaves strangely.
This commit is contained in:
parent
73a5800fbf
commit
7b0c96640c
3 changed files with 22 additions and 23 deletions
|
|
@ -213,15 +213,15 @@ def format_script_list(scripts):
|
|||
table.align = 'r'
|
||||
for script in scripts:
|
||||
nextrep = script.time_until_next_repeat()
|
||||
print ([script.id,
|
||||
(not hasattr(script, 'obj') or not script.obj) and "<Global>" or script.obj.key,
|
||||
script.key,
|
||||
(not hasattr(script, 'interval') or script.interval < 0) and "--" or "%ss" % script.interval,
|
||||
not nextrep and "--" or "%ss" % nextrep,
|
||||
(not hasattr(script, 'repeats') or not script.repeats) and "--" or "%i" % script.repeats,
|
||||
script.persistent and "*" or "-",
|
||||
script.typeclass_path.rsplit('.', 1)[-1],
|
||||
script.desc])
|
||||
#print ([script.id,
|
||||
# (not hasattr(script, 'obj') or not script.obj) and "<Global>" or script.obj.key,
|
||||
# script.key,
|
||||
# (not hasattr(script, 'interval') or script.interval < 0) and "--" or "%ss" % script.interval,
|
||||
# not nextrep and "--" or "%ss" % nextrep,
|
||||
# (not hasattr(script, 'repeats') or not script.repeats) and "--" or "%i" % script.repeats,
|
||||
# script.persistent and "*" or "-",
|
||||
# script.typeclass_path.rsplit('.', 1)[-1],
|
||||
# script.desc])
|
||||
table.add_row([script.id,
|
||||
(not hasattr(script, 'obj') or not script.obj) and "<Global>" or script.obj.key,
|
||||
script.key,
|
||||
|
|
|
|||
|
|
@ -635,19 +635,19 @@ class TypedObject(SharedMemoryModel):
|
|||
|
||||
# key property (wraps db_key)
|
||||
#@property
|
||||
#def __key_get(self):
|
||||
# "Getter. Allows for value = self.key"
|
||||
# return _GA(self, "db_key")
|
||||
# #return get_field_cache(self, "key")
|
||||
##@key.setter
|
||||
#def __key_set(self, value):
|
||||
# "Setter. Allows for self.key = value"
|
||||
# set_field_cache(self, "key", value)
|
||||
##@key.deleter
|
||||
#def __key_del(self):
|
||||
# "Deleter. Allows for del self.key"
|
||||
# raise Exception("Cannot delete objectdb key!")
|
||||
#key = property(__key_get, __key_set, __key_del)
|
||||
def __key_get(self):
|
||||
"Getter. Allows for value = self.key"
|
||||
return _GA(self, "db_key")
|
||||
#return get_field_cache(self, "key")
|
||||
#@key.setter
|
||||
def __key_set(self, value):
|
||||
"Setter. Allows for self.key = value"
|
||||
set_field_cache(self, "key", value)
|
||||
#@key.deleter
|
||||
def __key_del(self):
|
||||
"Deleter. Allows for del self.key"
|
||||
raise Exception("Cannot delete objectdb key!")
|
||||
key = property(__key_get, __key_set, __key_del)
|
||||
|
||||
# name property (alias to self.key)
|
||||
def __name_get(self): return self.key
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ class SharedMemoryModelBase(ModelBase):
|
|||
fset = lambda cls, val: _set(cls, fieldname, val)
|
||||
fdel = lambda cls: _del(cls, fieldname)
|
||||
doc = "Wraps setting, saving and deleting the %s field." % fieldname
|
||||
|
||||
type(cls).__setattr__(cls, wrappername, property(fget, fset, fdel, doc))
|
||||
|
||||
# exclude some models that should not auto-create wrapper fields
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue