lockhandler.get() returned on the wrong format. Now returns the lockstring as the API specifies. Resolves Issue 282.

This commit is contained in:
Griatch 2012-10-14 12:39:59 +02:00
parent 532cbc5fb6
commit d80daccb70
2 changed files with 6 additions and 5 deletions

View file

@ -1501,13 +1501,12 @@ class CmdLock(ObjManipCommand):
return return
lockdef = obj.locks.get(access_type) lockdef = obj.locks.get(access_type)
if lockdef: if lockdef:
string = lockdef[2]
if 'del' in self.switches: if 'del' in self.switches:
if not obj.access(caller, 'control'): if not obj.access(caller, 'control'):
caller.msg("You are not allowed to do that.") caller.msg("You are not allowed to do that.")
return return
obj.locks.delete(access_type) obj.locks.delete(access_type)
string = "deleted lock %s" % string string = "deleted lock %s" % lockdef
else: else:
string = "%s has no lock of access type '%s'." % (obj, access_type) string = "%s has no lock of access type '%s'." % (obj, access_type)
caller.msg(string) caller.msg(string)

View file

@ -300,9 +300,11 @@ class LockHandler(object):
self.add(old_lockstring, log_obj) self.add(old_lockstring, log_obj)
raise raise
def get(self, access_type): def get(self, access_type=None):
"get the lockstring of a particular type" "get the full lockstring or the lockstring of a particular access type."
return self.locks.get(access_type, None) if access_type:
return self.locks.get(access_type, ["","",""])[2]
return str(self)
def delete(self, access_type): def delete(self, access_type):
"Remove a lock from the handler" "Remove a lock from the handler"