magpie.ui.user

Package Contents

Functions

get_constant(constant_name: Str, settings_container: Optional[AnySettingsContainer] = None, settings_name: Optional[Str] = None, default_value: Optional[SettingValue] = None, raise_missing: bool = True, print_missing: bool = False, raise_not_set: bool = True) → SettingValue

Search in order for matched value of constant_name:

includeme(config)

magpie.ui.user.get_constant(constant_name: Str, settings_container: Optional[AnySettingsContainer] = None, settings_name: Optional[Str] = None, default_value: Optional[SettingValue] = None, raise_missing: bool = True, print_missing: bool = False, raise_not_set: bool = True) → SettingValue[source]
Search in order for matched value of constant_name:
  1. search in MAGPIE_CONSTANTS

  2. search in settings if specified

  3. search alternative setting names (see below)

  4. search in magpie.constants definitions

  5. search in environment variables

Parameter constant_name is expected to have the format MAGPIE_[VARIABLE_NAME] although any value can be passed to retrieve generic settings from all above mentioned search locations.

If settings_name is provided as alternative name, it is used as is to search for results if constant_name was not found. Otherwise, magpie.[variable_name] is used for additional search when the format MAGPIE_[VARIABLE_NAME] was used for constant_name (i.e.: MAGPIE_ADMIN_USER will also search for magpie.admin_user and so on for corresponding constants).

Parameters
  • constant_name – key to search for a value

  • settings_container – wsgi app settings container

  • settings_name – alternative name for settings if specified

  • default_value – default value to be returned if not found anywhere, and exception raises are disabled.

  • raise_missing – raise exception if key is not found anywhere

  • print_missing – print message if key is not found anywhere, return None

  • raise_not_set – raise an exception if the found key is None, search until last case if others are None

Returns

found value or default_value

Raises
  • ValueError – if resulting value is invalid based on options (by default raise missing/None value)

  • LookupError – if no appropriate value could be found from all search locations (according to options)

magpie.ui.user.LOGGER[source]
magpie.ui.user.includeme(config)[source]