Set the method to better report a malformed lockfunc rather than to raise a traceback.

This commit is contained in:
Griatch 2016-09-19 07:13:23 +02:00
parent 22e6cb4f8f
commit 9bab96e0e8

View file

@ -14,6 +14,7 @@ from evennia.comms.models import ChannelDB, Msg
from evennia.players.models import PlayerDB from evennia.players.models import PlayerDB
from evennia.players import bots from evennia.players import bots
from evennia.comms.channelhandler import CHANNELHANDLER from evennia.comms.channelhandler import CHANNELHANDLER
from evennia.locks.lockhandler import LockException
from evennia.utils import create, utils, evtable from evennia.utils import create, utils, evtable
from evennia.utils.utils import make_iter, class_from_module from evennia.utils.utils import make_iter, class_from_module
@ -605,7 +606,11 @@ class CmdClock(COMMAND_DEFAULT_CLASS):
self.msg(string) self.msg(string)
return return
# Try to add the lock # Try to add the lock
try:
channel.locks.add(self.rhs) channel.locks.add(self.rhs)
except LockException, err:
self.msg(err)
return
string = "Lock(s) applied. " string = "Lock(s) applied. "
string += "Current locks on %s:" % channel.key string += "Current locks on %s:" % channel.key
string = "%s\n %s" % (string, channel.locks) string = "%s\n %s" % (string, channel.locks)