Website Module

The website module uses Tornado, a fast and scalable python web server.

Main website

This is the external website users will see when interacting with IceProd. It has been broken down into several sub-handlers for easier maintenance.

class iceprod.server.modules.website.website(*args, **kwargs)[source]

The main website module.

Run the website, which is required for anything to work.

async stop()[source]

Stop website

start()[source]

Run the website

iceprod.server.modules.website.authenticated(method)[source]

Decorate methods with this to require that the user be logged in.

If the user is not logged in, they will be redirected to the configured login url <RequestHandler.get_login_url>.

If you configure a login url with a query parameter, Tornado will assume you know what you’re doing and use it as-is. If not, it will add a next parameter so the login page knows where to send you once you’re logged in.

iceprod.server.modules.website.eval_expression(token, e)[source]

from rest_tools.server.decorators.token_attribute_role_mapping_auth

class iceprod.server.modules.website.TokenStorageMixin[source]

Store/load current user’s OpenIDLoginHandler tokens in iceprod credentials API.

get_current_user()[source]
async get_current_user_async()[source]

Get the current user, and set auth-related attributes.

store_tokens(access_token, access_token_exp, refresh_token=None, refresh_token_exp=None, user_info=None, user_info_exp=None)[source]

Store jwt tokens and user info from OpenID-compliant auth source.

Parameters:
  • access_token (str) – jwt access token

  • access_token_exp (int) – access token expiration in seconds

  • refresh_token (str) – jwt refresh token

  • refresh_token_exp (int) – refresh token expiration in seconds

  • user_info (dict) – user info (from id token or user info lookup)

  • user_info_exp (int) – user info expiration in seconds

clear_tokens()[source]

Clear token data, usually on logout.

class iceprod.server.modules.website.Login(*args, **kwargs)[source]
initialize(cred_rest_client=None, full_url=None, **kwargs)[source]
class iceprod.server.modules.website.PublicHandler(*args, **kwargs)[source]

Default Handler

initialize(cfg=None, modules=None, statsd=None, rest_api=None, cred_rest_client=None, system_rest_client=None, full_url=None, **kwargs)[source]

Get some params from the website module

Parameters:
  • cfg – the global config

  • modules – modules handle

  • statsd – statsd client

  • rest_api – the rest api url

get_template_namespace()[source]

Returns a dictionary to be used as the default template namespace.

May be overridden by subclasses to add or modify values.

The results of this method will be combined with additional defaults in the tornado.template module and keyword arguments to render or render_string.

async get_current_user_async()[source]

Get the current user, and set auth-related attributes.

write_error(**kwargs: Any) Any

Override to implement custom error pages.

write_error may call write, render, set_header, etc to produce output as usual.

If this error was caused by an uncaught exception (including HTTPError), an exc_info triple will be available as kwargs["exc_info"]. Note that this exception may not be the “current” exception for purposes of methods like sys.exc_info() or traceback.format_exc.

class iceprod.server.modules.website.Default(*args, **kwargs)[source]

Handle / urls

async get()[source]
class iceprod.server.modules.website.Submit(*args, **kwargs)[source]

Handle /submit urls

async get()[source]
class iceprod.server.modules.website.Config(*args, **kwargs)[source]

Handle /config urls

async get()[source]
class iceprod.server.modules.website.DatasetBrowse(*args, **kwargs)[source]

Handle /dataset urls

get_usernames()[source]
async get()[source]
class iceprod.server.modules.website.Dataset(*args, **kwargs)[source]

Handle /dataset urls

async get(dataset_id)[source]
class iceprod.server.modules.website.TaskBrowse(*args, **kwargs)[source]

Handle /task urls

async get(dataset_id)[source]
class iceprod.server.modules.website.Task(*args, **kwargs)[source]

Handle /task urls

async get(dataset_id, task_id)[source]
class iceprod.server.modules.website.JobBrowse(*args, **kwargs)[source]

Handle /job urls

async get(dataset_id)[source]
class iceprod.server.modules.website.Job(*args, **kwargs)[source]

Handle /job urls

async get(dataset_id, job_id)[source]
class iceprod.server.modules.website.Documentation(*args, **kwargs)[source]
async get(url)[source]
class iceprod.server.modules.website.Log(*args, **kwargs)[source]
async get(dataset_id, log_id)[source]
class iceprod.server.modules.website.Help(*args, **kwargs)[source]

Help Page

async get()[source]
class iceprod.server.modules.website.Other(*args, **kwargs)[source]

Handle any other urls - this is basically all 404

async get()[source]
class iceprod.server.modules.website.Profile(*args, **kwargs)[source]

Handle user profile page

async get()[source]
async post()[source]
class iceprod.server.modules.website.Logout(*args, **kwargs)[source]
async get()[source]