From 7237be87c6daaaed49fdade739677104c7ed8a75 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 8 Sep 2011 10:41:55 +0000 Subject: [PATCH] Fixing typo in lock definitions for @dig as well as docstrings. Patch by sergi.reyner. Resolves issue 186. --- src/commands/default/building.py | 2 +- src/locks/lockhandler.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/default/building.py b/src/commands/default/building.py index c900626c21..fba1cd9821 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -618,7 +618,7 @@ class CmdDig(ObjManipCommand): typeclass = settings.BASE_ROOM_TYPECLASS # create room - lockstring = "control:id(%s) or perm(Immortal); delete:id(%s) or perm(Wizard); edit:id(%s) or perm(Wizard)" + lockstring = "control:id(%s) or perm(Immortals); delete:id(%s) or perm(Wizards); edit:id(%s) or perm(Wizards)" lockstring = lockstring % (caller.dbref, caller.dbref, caller.dbref) new_room = create.create_object(typeclass, room["name"], diff --git a/src/locks/lockhandler.py b/src/locks/lockhandler.py index 73a9e631ee..f42121e1af 100644 --- a/src/locks/lockhandler.py +++ b/src/locks/lockhandler.py @@ -58,18 +58,18 @@ Example: We want to limit who may edit a particular object (let's call this access_type for 'edit', it depends on what the command is looking for). We want this to -only work for those with the Permission 'Builder'. So we use our lock +only work for those with the Permission 'Builders'. So we use our lock function above and call it like this: - 'edit:perm(Builder)' + 'edit:perm(Builders)' Here, the lock-function perm() will be called (accessing_obj and accessed_obj are added automatically, you only need to add the args/kwargs, if any). -If we wanted to make sure the accessing object was BOTH a Builder and a GoodGuy, we +If we wanted to make sure the accessing object was BOTH a Builders and a GoodGuy, we could use AND: - 'edit:perm(Builder) AND perm(GoodGuy)' + 'edit:perm(Builders) AND perm(GoodGuy)' To allow EITHER Builders and GoodGuys, we replace AND with OR. perm() is just one example, the lock function can do anything and compare any properties of the calling object to @@ -80,7 +80,7 @@ decide if the lock is passed or not. To make these work, add the string to the lockhandler of the object you want to apply the lock to: - obj.lockhandler.add('edit:perm(Builder)') + obj.lockhandler.add('edit:perm(Builders)') From then on, a command that wants to check for 'edit' access on this object would do something like this: