handlers module

Sputnik Request Handlers

This module provides Tornado Request Handlers for the Sputnik Web Interface.

class handlers.AddHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The RequestHandler that serves the add network page.

The add network page uses a form to receive new network settings. If a network already exists using the provided name, the network is not added.

get()[source]

Renders the add network page.

The add network page provides a form for adding a new network, complete with placeholder settings.

post()[source]

Handles add network requests.

If a network already exists using the provided name, the network is not added.

class handlers.BaseHandler(application, request, **kwargs)[source]

Bases: tornado.web.RequestHandler

A base handler that stores the Bouncer singleton.

get_current_user()[source]
initialize(bouncer)[source]

Initializes the RequestHandler and stores the Bouncer.

Parameters:bouncer (sputnik.Bouncer) – The singleton Bouncer instance.
class handlers.DeleteHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The RequestHandler that handles delete network requests.

get(network_name)[source]

Handles delete network requests.

Parameters:network_name (str) – Network name of the network to delete.
class handlers.EditHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The RequestHandler that serves the edit network page.

The edit network page uses a form to receive updated settings from users. When a network is editted, it is disconnected and then recreated using the new settings.

get(network_name)[source]

Renders the edit network page.

The edit network page shows current settings for a network and provides a form for submitting changes to that network.

Parameters:network_name (str) – Network name of the network to edit.
post(network_name)[source]

Handles edit network requests.

The existing network is disconnected and a new connection is started using the new settings.

Parameters:network_name (str) – Network name of the network to edit.
class handlers.LoginHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The RequestHandler that serves the login page.

The login page prompts the user for their password and authenticates them when the password matches the one stored by the bouncer in its database.

get()[source]

Renders the login page.

The login page uses a form to ask the user for their password.

post()[source]

Handles login requests.

Checks the password against the stored password and authenticates.

class handlers.LogoutHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The RequestHandler that handles log out requests.

Redirects to the homepage after clearing authentication.

get()[source]

Handles log out requests.

Redirects to the homepage after clearing authentication.

class handlers.MainHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The main RequestHandler that serves the home page.

The home page displays the current list of networks.

get()[source]

Renders the home page.

The home page displays the current list of networks.

class handlers.SettingsHandler(application, request, **kwargs)[source]

Bases: handlers.BaseHandler

The RequestHandler that serves the settings page.

Allows users to change their password.

get()[source]

Renders the settings page.

The settings page uses a form to allow users to change their password.

post()[source]

Handles settings requests.

Change password requests require the current password to match and two entries of the new password to match.