Fixed bug in delcom.

This commit is contained in:
Griatch 2013-10-21 22:51:16 +02:00
parent 06a0bea8d6
commit 3430aa9eae
4 changed files with 20 additions and 18 deletions

View file

@ -149,7 +149,7 @@ class CmdDelCom(MuxPlayerCommand):
chkey = channel.key.lower()
# find all nicks linked to this channel and delete them
for nick in [nick for nick in caller.nicks.get(category="channel")
if nick.db_data.lower() == chkey]:
if nick.strvalue.lower() == chkey]:
nick.delete()
disconnect = channel.disconnect_from(player)
if disconnect:

View file

@ -393,11 +393,11 @@ class ChannelDB(TypedObject):
def disconnect_from(self, player):
"Disconnect user from this channel."
disconnect = self.typeclass.pre_leave_channel(self, player)
disconnect = self.typeclass.pre_leave_channel(player)
if not disconnect:
return False
PlayerChannelConnection.objects.break_connection(player, self)
self.typeclass.post_leave_channel(self, player)
self.typeclass.post_leave_channel(player)
return True
def delete(self):

View file

@ -304,15 +304,14 @@ class ObjectDB(TypedObject):
return self.typeclass
if use_nicks:
nicktype = "object"
# get all valid nicks to search
nicks = self.nicks.all(category="object_nick_%s" % nicktype)
nicks = self.nicks.all(category="object")
if self.has_player:
pnicks = self.nicks.all(category="player_nick_%s" % nicktype)
pnicks = self.nicks.all(category="player")
nicks = nicks + pnicks
for nick in nicks:
if searchdata == nick.db_key:
searchdata = nick.db_data
searchdata = nick.strvalue
break
candidates=None

View file

@ -242,21 +242,24 @@ class AttributeHandler(object):
checked before displaying each looked-after Attribute. If no
accessing_obj is given, no check will be done.
"""
if not key:
return None
if self._cache == None or not _TYPECLASS_AGGRESSIVE_CACHE:
self._recache()
catkey = to_str(category, force_string=True).lower()
ret = []
for keystr in ("%s_%s" % (k.lower(), catkey) for k in make_iter(key)):
attr_obj = self._cache.get(keystr)
if attr_obj:
ret.append(attr_obj)
else:
if raise_exception:
raise AttributeError
catkey = to_str(category, force_string=True).lower()
if not key:
# return all with matching category (or no category)
catkey = "_%s" % catkey
ret = [attr for key, attr in self._cache.items() if key.endswith(catkey)]
else:
for keystr in ("%s_%s" % (k.lower(), catkey) for k in make_iter(key)):
attr_obj = self._cache.get(keystr)
if attr_obj:
ret.append(attr_obj)
else:
ret.append(default)
if raise_exception:
raise AttributeError
else:
ret.append(default)
if accessing_obj:
# check 'attrread' locks
ret = [attr for attr in ret if attr.access(accessing_obj, self._attrread, default=default_access)]