Move the interrupting exception of events

This commit is contained in:
Vincent Le Goff 2017-04-22 19:37:32 -07:00 committed by Griatch
parent 96b90dde1e
commit bc9bfb3fa7
4 changed files with 14 additions and 18 deletions

View file

@ -6,7 +6,7 @@ Eventfuncs are just Python functions that can be used inside of calllbacks.
""" """
from evennia import ObjectDB, ScriptDB from evennia import ObjectDB, ScriptDB
from evennia.contrib.events.exceptions import InterruptEvent from evennia.contrib.events.utils import InterruptEvent
def deny(): def deny():
""" """

View file

@ -1,15 +0,0 @@
"""
Module containing the exceptions of the event system.
"""
class InterruptEvent(RuntimeError):
"""
Interrupt the current event.
You shouldn't have to use this exception directly, probably use the
`deny()` function that handles it instead.
"""
pass

View file

@ -14,9 +14,8 @@ from evennia import logger
from evennia.utils.create import create_channel from evennia.utils.create import create_channel
from evennia.utils.dbserialize import dbserialize from evennia.utils.dbserialize import dbserialize
from evennia.utils.utils import all_from_module, delay from evennia.utils.utils import all_from_module, delay
from evennia.contrib.events.exceptions import InterruptEvent
from evennia.contrib.events.handler import CallbackHandler from evennia.contrib.events.handler import CallbackHandler
from evennia.contrib.events.utils import get_next_wait, EVENTS from evennia.contrib.events.utils import get_next_wait, EVENTS, InterruptEvent
# Constants # Constants
RE_LINE_ERROR = re.compile(r'^ File "\<string\>", line (\d+)') RE_LINE_ERROR = re.compile(r'^ File "\<string\>", line (\d+)')

View file

@ -233,3 +233,15 @@ def phrase_event(callbacks, parameters):
to_call.append(callback) to_call.append(callback)
return to_call return to_call
class InterruptEvent(RuntimeError):
"""
Interrupt the current event.
You shouldn't have to use this exception directly, probably use the
`deny()` function that handles it instead.
"""
pass