mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 02:42:56 +00:00 
			
		
		
		
	Use new event handling model
This commit is contained in:
		@@ -5,11 +5,12 @@ from tornado.ioloop import IOLoop
 | 
			
		||||
from tornado.web import RequestHandler, Application
 | 
			
		||||
 | 
			
		||||
from tfw.builtins import FSMAwareEventHandler
 | 
			
		||||
from tfw.main import EventHandlerFactory
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ControllerPostHandler(RequestHandler):
 | 
			
		||||
    # pylint: disable=abstract-method
 | 
			
		||||
    def initialize(self, **kwargs): # pylint: disable=arguments-differ
 | 
			
		||||
    # pylint: disable=abstract-method,attribute-defined-outside-init,unused-argument
 | 
			
		||||
    def initialize(self, **kwargs):
 | 
			
		||||
        self.controller = kwargs['controller']
 | 
			
		||||
 | 
			
		||||
    def post(self, *args, **kwargs):
 | 
			
		||||
@@ -26,6 +27,8 @@ class ControllerEventHandler(FSMAwareEventHandler):
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    controller = ControllerEventHandler('controller')
 | 
			
		||||
    controller_eh = EventHandlerFactory().build(controller)
 | 
			
		||||
 | 
			
		||||
    application = Application([(
 | 
			
		||||
        f'/{os.environ["SECRET"]}',
 | 
			
		||||
        ControllerPostHandler,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user