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
lockdef = obj.locks.get(access_type)
if lockdef:
string = lockdef[2]
if 'del' in self.switches:
if not obj.access(caller, 'control'):
caller.msg("You are not allowed to do that.")
return
obj.locks.delete(access_type)
string = "deleted lock %s" % string
string = "deleted lock %s" % lockdef
else:
string = "%s has no lock of access type '%s'." % (obj, access_type)
caller.msg(string)

View file

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