From d80daccb70d9b6a050e7f6c552cc59ef506ab1b3 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 14 Oct 2012 12:39:59 +0200 Subject: [PATCH] lockhandler.get() returned on the wrong format. Now returns the lockstring as the API specifies. Resolves Issue 282. --- src/commands/default/building.py | 3 +-- src/locks/lockhandler.py | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 04d38e9dff..928d19916c 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -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) diff --git a/src/locks/lockhandler.py b/src/locks/lockhandler.py index df521aa375..5262fb423d 100644 --- a/src/locks/lockhandler.py +++ b/src/locks/lockhandler.py @@ -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"