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() chkey = channel.key.lower()
# find all nicks linked to this channel and delete them # find all nicks linked to this channel and delete them
for nick in [nick for nick in caller.nicks.get(category="channel") 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() nick.delete()
disconnect = channel.disconnect_from(player) disconnect = channel.disconnect_from(player)
if disconnect: if disconnect:

View file

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

View file

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

View file

@ -242,12 +242,15 @@ class AttributeHandler(object):
checked before displaying each looked-after Attribute. If no checked before displaying each looked-after Attribute. If no
accessing_obj is given, no check will be done. accessing_obj is given, no check will be done.
""" """
if not key:
return None
if self._cache == None or not _TYPECLASS_AGGRESSIVE_CACHE: if self._cache == None or not _TYPECLASS_AGGRESSIVE_CACHE:
self._recache() self._recache()
catkey = to_str(category, force_string=True).lower()
ret = [] ret = []
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)): for keystr in ("%s_%s" % (k.lower(), catkey) for k in make_iter(key)):
attr_obj = self._cache.get(keystr) attr_obj = self._cache.get(keystr)
if attr_obj: if attr_obj: