handlers¶
-
class
AdminHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
backend.handlers.SafeHandler
-
class
AngularTemplate(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶
-
class
AuthorizedHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
backend.handlers.SafeHandler
-
class
AuthorizedStaticNginxFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
backend.handlers.AuthorizedHandler,backend.handlers.BaseStaticNginxFileHandlerServe static files for authenticated users from the nginx frontend
Requires a “path” argument in constructor which should be the root of the nginx frontend where the files can be found. Then configure the nginx frontend something like this:
location <path> { internal; alias <location of files>; }
-
class
BaseHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
tornado.web.RequestHandlerBase Handler. Handlers should not inherit from this class directly but from either SafeHandler or UnsafeHandler to make security status explicit.
-
get_current_user()[source]¶ Override to determine the current user from, e.g., a cookie.
This method may not be a coroutine.
-
on_finish()[source]¶ Called after the end of a request.
Override this method to perform cleanup, logging, etc. This method is a counterpart to prepare.
on_finishmay not produce any output, as it is called after the response has been sent to the client.
-
prepare()[source]¶ Called at the beginning of a request before get/post/etc.
Override this method to perform common initialization regardless of the request method.
Asynchronous support: Use
async defor decorate this method with .gen.coroutine to make it asynchronous. If this method returns anAwaitableexecution will not proceed until theAwaitableis done.New in version 3.1: Asynchronous support.
-
set_user_msg(msg, level='info')[source]¶ This function sets the user message cookie. The system takes four default levels, ‘success’, ‘info’, ‘warning’, and ‘error’. Messages set to other levels will be defaulted to ‘info’.
-
write(chunk)[source]¶ Writes the given chunk to the output buffer.
To write the output to the network, use the flush() method below.
If the given chunk is a dictionary, we write it as JSON and set the Content-Type of the response to be
application/json. (if you want to send JSON as a differentContent-Type, callset_headerafter callingwrite()).Note that lists are not converted to JSON because of a potential cross-site security vulnerability. All JSON output should be wrapped in a dictionary. More details at http://haacked.com/archive/2009/06/25/json-hijacking.aspx/ and https://github.com/facebook/tornado/issues/1009
-
write_error(status_code, **kwargs)[source]¶ Overwrites write_error method to have custom error pages. http://tornado.readthedocs.org/en/latest/web.html#tornado.web.RequestHandler.write_error
-
-
class
BaseStaticNginxFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
backend.handlers.UnsafeHandlerServe static files for users from the nginx frontend
Requires a
pathargument in constructor which should be the root of the nginx frontend where the files can be found. Then configure the nginx frontend something like this:location <path> { internal; alias <location of files>; }
-
class
SafeHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
backend.handlers.BaseHandlerAll handlers that need authentication and authorization should inherit from this class.
-
class
SafeStaticFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
tornado.web.StaticFileHandler,backend.handlers.SafeHandlerServe static files for logged in users
-
class
TemporaryStaticNginxFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶
-
class
UnsafeHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]¶ Bases:
backend.handlers.BaseHandler