handlers

class AdminHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.SafeHandler

prepare()[source]

This method is called before any other method. Having the decorator @tornado.web.authenticated here implies that all the Handlers that inherit from this one are going to require authentication in all their methods.

class AngularTemplate(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.UnsafeHandler

get(path)[source]
initialize(path)[source]
class AuthorizedHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.SafeHandler

prepare()[source]

This method is called before any other method. Having the decorator @tornado.web.authenticated here implies that all the Handlers that inherit from this one are going to require authentication in all their methods.

class AuthorizedStaticNginxFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.AuthorizedHandler, backend.handlers.BaseStaticNginxFileHandler

Serve 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.RequestHandler

Base 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_finish may 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 def or decorate this method with .gen.coroutine to make it asynchronous. If this method returns an Awaitable execution will not proceed until the Awaitable is 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 different Content-Type, call set_header after calling write()).

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.UnsafeHandler

Serve static files for 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>;
}
get(dataset, file, ds_version=None, user=None)[source]
initialize(path)[source]
class SafeHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.BaseHandler

All handlers that need authentication and authorization should inherit from this class.

prepare()[source]

This method is called before any other method. Having the decorator @tornado.web.authenticated here implies that all the Handlers that inherit from this one are going to require authentication in all their methods.

class SafeStaticFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: tornado.web.StaticFileHandler, backend.handlers.SafeHandler

Serve static files for logged in users

class TemporaryStaticNginxFileHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.BaseStaticNginxFileHandler

get(dataset, ds_version, hash_value, file)[source]
class UnsafeHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: backend.handlers.BaseHandler