From 3cf01ce711cb92bc52ee424b4564bdcaf2504054 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 2 Jul 2013 11:51:04 +0200 Subject: [PATCH] Reverted previous merge, instead solving the issue by the metaclass making sure to add cmd:all() to the exit command only if the object itself does not specify it. --- src/commands/command.py | 2 +- src/objects/migrations/0005_add_object_default_locks.py | 6 +++--- src/objects/objects.py | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/commands/command.py b/src/commands/command.py index 395aa024ea..0c65a90873 100644 --- a/src/commands/command.py +++ b/src/commands/command.py @@ -48,7 +48,7 @@ def _init_command(mcs, **kwargs): if not hasattr(mcs, 'locks'): # default if one forgets to define completely mcs.locks = "cmd:all()" - elif not "cmd:" in mcs.locks: + if not "cmd:" in mcs.locks: mcs.locks = "cmd:all();" + mcs.locks for lockstring in mcs.locks.split(';'): if lockstring and not ':' in lockstring: diff --git a/src/objects/migrations/0005_add_object_default_locks.py b/src/objects/migrations/0005_add_object_default_locks.py index 8dccaf25b5..0ae1bd3dd4 100644 --- a/src/objects/migrations/0005_add_object_default_locks.py +++ b/src/objects/migrations/0005_add_object_default_locks.py @@ -10,7 +10,7 @@ class Migration(DataMigration): "Write your forwards methods here." # we need to add a default lock string to all objects, then a separate set to Characters. - + lockstring1 = 'control:id(1);get:all();edit:perm(Wizards);examine:perm(Builders);call:true();puppet:id(#4) or perm(Immortals) or pperm(Immortals);delete:id(1) or perm(Wizards)' lockstring2 = 'control:id(#3) or perm(Immortals);get:perm(Wizards);edit:perm(Wizards);examine:perm(Builders);call:false();puppet:id(%i) or pid(%i) or perm(Immortals) or pperm(Immortals);delete:perm(Wizards)' @@ -21,10 +21,10 @@ class Migration(DataMigration): for obj in orm.ObjectDB.objects.filter(db_player__isnull=False): obj.db_lock_storage = lockstring2 % (obj.id, obj.db_player.id) obj.save() - + except utils.DatabaseError: # running from scatch. In this case we just ignore this. - pass + pass def backwards(self, orm): "Write your backwards methods here." diff --git a/src/objects/objects.py b/src/objects/objects.py index 73156c632e..6a748cdbb3 100644 --- a/src/objects/objects.py +++ b/src/objects/objects.py @@ -911,6 +911,7 @@ class Exit(Object): # create an exit command. cmd = ExitCommand(key=exidbobj.db_key.strip().lower(), aliases=exidbobj.aliases, + locks=str(exidbobj.locks), auto_help=False, destination=exidbobj.db_destination, obj=exidbobj)