the user module

This module implements the live data structures needed for Flask as well as notifications. See related topic:

digraph inheritance9dc66ea023 { rankdir=LR; size="8.0, 12.0"; "seaice.user.AnonymousUser" [style="setlinewidth(0.5)",URL="#seaice.user.AnonymousUser",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Handler for non-authenticated sessions.",height=0.25,shape=box,fontsize=10]; "seaice.user.BaseUser" -> "seaice.user.AnonymousUser" [arrowsize=0.5,style="setlinewidth(0.5)"]; "seaice.user.BaseUser" [style="setlinewidth(0.5)",URL="#seaice.user.BaseUser",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Base class for users. Users are used in Flask fo storing ",height=0.25,shape=box,fontsize=10]; "seaice.user.User" [style="setlinewidth(0.5)",URL="#seaice.user.User",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Handler for authenticated sessions.",height=0.25,shape=box,fontsize=10]; "seaice.user.BaseUser" -> "seaice.user.User" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class seaice.user.BaseUser(id, name)[source]
Base class for users. Users are used in Flask fo storing information about active and authenticated user sessions. This implements. BaseUser implements the basic routines needed for the Flask login manager. See the Flask-Login documenttation for details.
Parameters:
  • id (int) – User’s surrogate ID in the database.
  • name (str) – First name of user (for display purposes).
get_id()[source]

Required by Flask-Login.

Return type:unicode str
is_active()[source]

Required by Flask-Login.

is_anonymous()[source]

Required by Flask-Login.

is_authenticated()[source]

Required by Flask-Login.

class seaice.user.User(id, name)[source]

Bases: seaice.user.BaseUser

Handler for authenticated sessions.

getNotificationsAsHTML(db_con)[source]

Get notifications as HTML.

Create a link next each one which, when clicked, calls User.remove().
Parameters:db_con (seaice.SeaIceConnector.SeaIceConnector) – DB connection.
Returns:HTML-formatted string.
getNotificationsAsPlaintext(db_con)[source]

Get notifications in plaintext form.

Parameters:db_con (seaice.SeaIceConnector.SeaIceConnector) – DB connection.
Returns:Plaintext string.
notify(notif, db_con=None)[source]

Receive notification from another user.

If db_con is specified, insert the notifiation into the databse. The reason for having this option is that not all deployments of SeaIce will need to have persistent notifications. This method is thread-safe, as it’s possible to receive many notifications simultaneously.
Parameters:
remove(i, db_con=None)[source]

Remove notification at index i from the list.

If db_con is specified, then remove notification from the database. This method is thread-safe. NOTE: If the order of notifications changed sometime between this point and the last time the HTML page was generated, the wrong notification will be removed.
Parameters:
class seaice.user.AnonymousUser[source]

Bases: seaice.user.BaseUser

Handler for non-authenticated sessions.

id = None

When polled, return None for ID, as prescribed by Flask-Login.

logged_in = None

When asked if you are logged in, always respond with no.

Previous topic

class IdPool

Next topic

The auth module

This Page