mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2025-06-28 10:35:12 +00:00
Comply new package structure
This commit is contained in:
@ -4,8 +4,8 @@ import json
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.web import RequestHandler, Application
|
||||
|
||||
from tfw.builtins import FSMAwareEventHandler
|
||||
from tfw.main import EventHandlerFactory
|
||||
from tfw.event_handlers import FSMAwareEventHandler
|
||||
from tfw.main import EventHandlerFactory, setup_signal_handlers
|
||||
|
||||
|
||||
class ControllerPostHandler(RequestHandler):
|
||||
@ -20,23 +20,18 @@ class ControllerPostHandler(RequestHandler):
|
||||
}))
|
||||
|
||||
|
||||
class ControllerEventHandler(FSMAwareEventHandler):
|
||||
def handle_event(self, message):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
controller = ControllerEventHandler('controller')
|
||||
controller_eh = EventHandlerFactory().build(controller)
|
||||
controller_eh = EventHandlerFactory().build(
|
||||
lambda *_: None,
|
||||
event_handler_type=FSMAwareEventHandler
|
||||
)
|
||||
|
||||
application = Application([(
|
||||
f'/{os.environ["SECRET"]}',
|
||||
ControllerPostHandler,
|
||||
{'controller': controller}
|
||||
{'controller': controller_eh}
|
||||
)])
|
||||
application.listen(os.environ['CONTROLLER_PORT'])
|
||||
|
||||
try:
|
||||
IOLoop.instance().start()
|
||||
finally:
|
||||
controller.cleanup()
|
||||
setup_signal_handlers()
|
||||
IOLoop.instance().start()
|
||||
|
Reference in New Issue
Block a user