From bc9bfb3fa7c48e1b079a1d1634db5190df70e40e Mon Sep 17 00:00:00 2001 From: Vincent Le Goff Date: Sat, 22 Apr 2017 19:37:32 -0700 Subject: [PATCH] Move the interrupting exception of events --- evennia/contrib/events/eventfuncs.py | 2 +- evennia/contrib/events/exceptions.py | 15 --------------- evennia/contrib/events/scripts.py | 3 +-- evennia/contrib/events/utils.py | 12 ++++++++++++ 4 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 evennia/contrib/events/exceptions.py diff --git a/evennia/contrib/events/eventfuncs.py b/evennia/contrib/events/eventfuncs.py index b72afff86f..d81f35cbd4 100644 --- a/evennia/contrib/events/eventfuncs.py +++ b/evennia/contrib/events/eventfuncs.py @@ -6,7 +6,7 @@ Eventfuncs are just Python functions that can be used inside of calllbacks. """ from evennia import ObjectDB, ScriptDB -from evennia.contrib.events.exceptions import InterruptEvent +from evennia.contrib.events.utils import InterruptEvent def deny(): """ diff --git a/evennia/contrib/events/exceptions.py b/evennia/contrib/events/exceptions.py deleted file mode 100644 index b33e4a3e29..0000000000 --- a/evennia/contrib/events/exceptions.py +++ /dev/null @@ -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 diff --git a/evennia/contrib/events/scripts.py b/evennia/contrib/events/scripts.py index e63486db62..b6a4d802f9 100644 --- a/evennia/contrib/events/scripts.py +++ b/evennia/contrib/events/scripts.py @@ -14,9 +14,8 @@ from evennia import logger from evennia.utils.create import create_channel from evennia.utils.dbserialize import dbserialize 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.utils import get_next_wait, EVENTS +from evennia.contrib.events.utils import get_next_wait, EVENTS, InterruptEvent # Constants RE_LINE_ERROR = re.compile(r'^ File "\", line (\d+)') diff --git a/evennia/contrib/events/utils.py b/evennia/contrib/events/utils.py index bc485b1529..de036ca45c 100644 --- a/evennia/contrib/events/utils.py +++ b/evennia/contrib/events/utils.py @@ -233,3 +233,15 @@ def phrase_event(callbacks, parameters): to_call.append(callback) 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