Toto 1.0.10 documentation

Built-in Methods

«  Events   ::   Contents   ::   Toto Services  »

Built-in Methods

Toto includes some built-in methods to support frequently used functionality. These methods can be included in your method module by importing them into the module scope like this:

#main methods module __init__.py
import toto.methods.account.create as account_create

#method.account module
import toto.methods.account.create as create

In the above examples, Toto’s built in account.create method can be called from your method module as account_create and account.create respecively.

Methods

toto.methods.client_error.invoke(handler, parameters)[source]
A convenince method for writing browser errors

to Toto’s server log. It works with the registerErrorHandler() method in toto.js.

The “client_error” parameter should be set to the string to be written to Toto’s log. Currently, the “client_type” parameter must be set to “browser_js” for an event to be written. Otherwise, this method has no effect.

Requires: client_error, client_type

Required parameters: client_error, client_type.

Accounts

The methods.account module provides simple implementations of common methods around account creation and management.

toto.methods.account.create.invoke(handler, parameters)[source]
Create an account with the given user_id and password if no account

matching the user_id exists. Any other parameters will be added as additional properties of the account. If using a database with a predefined schema, make sure they match existing columns, otherwise an error will be returned.

Requires: user_id, password

Required parameters: user_id, password.

toto.methods.account.login.invoke(handler, parameters)[source]
Creates a new session for the account matching user_id and password. If no

matching account is found, a “User not found” error will be returned.

Requires: user_id, password

Required parameters: user_id, password.

toto.methods.account.logout.invoke(handler, parameters)[source]
Invalidates the current authenticated session. If the request is
not authenticated, a “Not authorized” error will be returned.

Requires authentication.

«  Events   ::   Contents   ::   Toto Services  »