Changed lockhandler.add/replace to use LockExceptions instead of log_obj, which should also work more flexibly for handling lock errors for players. Resolves #410.
This commit is contained in:
parent
9784a2a5c0
commit
3848a789a7
3 changed files with 16 additions and 22 deletions
|
|
@ -8,6 +8,7 @@ from django.conf import settings
|
|||
from src.objects.models import ObjectDB
|
||||
from src.utils import create, utils, search
|
||||
from src.utils.ansi import raw
|
||||
from src.locks.lockhandler import LockException
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from src.commands.cmdhandler import get_and_merge_cmdsets
|
||||
|
||||
|
|
@ -1555,7 +1556,10 @@ class CmdLock(ObjManipCommand):
|
|||
if not obj.access(caller, 'control'):
|
||||
caller.msg("You are not allowed to do that.")
|
||||
return
|
||||
ok = obj.locks.add(lockdef, caller)
|
||||
try:
|
||||
ok = obj.locks.add(lockdef)
|
||||
except LockException, e:
|
||||
caller.msg(str(e))
|
||||
if ok:
|
||||
caller.msg("Added lock '%s' to %s." % (lockdef, obj))
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue