mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 07:16:31 +01:00
Fixed a bug in removing tags from TagHandler.
This commit is contained in:
parent
bb7b73b7c2
commit
f9c47e7945
2 changed files with 12 additions and 11 deletions
|
|
@ -506,12 +506,13 @@ class CmdPerm(MuxCommand):
|
|||
tstring = ""
|
||||
if 'del' in switches:
|
||||
# delete the given permission(s) from object.
|
||||
obj.permissions.remove(self.rhslist)
|
||||
if obj.permissions.get(self.rhslist):
|
||||
cstring += "\nPermissions(s) %s could not be removed from %s." % (", ".join(self.rhslist), obj.name)
|
||||
else:
|
||||
cstring += "\nPermission(s) %s removed from %s (if they existed)." % (", ".join(self.rhslist), obj.name)
|
||||
tstring += "\n%s revokes the permission(s) %s from you." % (caller.name, ", ".join(self.rhslist))
|
||||
for perm in self.rhslist:
|
||||
obj.permissions.remove(perm)
|
||||
if obj.permissions.get(perm):
|
||||
cstring += "\nPermissions %s could not be removed from %s." % (perm, obj.name)
|
||||
else:
|
||||
cstring += "\nPermission %s removed from %s (if they existed)." % (perm, obj.name)
|
||||
tstring += "\n%s revokes the permission(s) %s from you." % (caller.name, perm)
|
||||
else:
|
||||
# add a new permission
|
||||
permissions = obj.permissions.all()
|
||||
|
|
|
|||
|
|
@ -558,17 +558,17 @@ class TagHandler(object):
|
|||
ret = []
|
||||
category = category.strip().lower() if category is not None else None
|
||||
searchkey = ["%s-%s" % (key.strip().lower(), category) if key is not None else None for key in make_iter(key)]
|
||||
ret = [val for val in (self._cache.get(searchkey) for keystr in key) if val]
|
||||
ret = [val for val in (self._cache.get(keystr) for keystr in searchkey) if val]
|
||||
ret = [to_str(tag.db_data) for tag in ret] if return_tagobj else ret
|
||||
return ret[0] if len(ret) == 1 else ret
|
||||
|
||||
def remove(self, key, category=None):
|
||||
"Remove a tag from the handler based ond key and category."
|
||||
for tag in make_iter(tag):
|
||||
if not (tag or tag.strip()): # we don't allow empty tags
|
||||
for key in make_iter(key):
|
||||
if not (key or key.strip()): # we don't allow empty tags
|
||||
continue
|
||||
tagstr = tag.strip().lower() if tag is not None else None
|
||||
category = category.strip().lower() if tag is not None else None
|
||||
tagstr = key.strip().lower()
|
||||
category = category.strip().lower() if category is not None else None
|
||||
|
||||
# This does not delete the tag object itself. Maybe it should do
|
||||
# that when no objects reference the tag anymore (how to check)?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue