apicrud.AccountSettings

class apicrud.AccountSettings(account_id, db_session=None, uid=None)

Access class for account settings, with cache - converts db record to object attributes

Each account is associated with an entry in the Settings model; this class provides access to these key-value pairs as read-only attributes. Because these functions are called frequently, the db entry is loaded into memory for a configurable expiration period (config.REDIS_TTL).

Parameters
  • account_id (str) – ID in database of a user’s account

  • db_session (obj) – a session connected to database

  • uid (str) – User ID

__init__(account_id, db_session=None, uid=None)

Cache per-account settings and convert to attributes

Methods

__init__(account_id[, db_session, uid])

Cache per-account settings and convert to attributes

uncache()

Clear the cached settings for account_id

Attributes

locale

Returns the language for the uid if specified in the user’s profile

property locale

Returns the language for the uid if specified in the user’s profile

uncache()

Clear the cached settings for account_id