Package expedient :: Package clearinghouse :: Package defaultsettings :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Contains functions to help with default settings Created on Feb 14, 2011


Author: jnaous

Functions [hide private]
 
append_to_local_setting(setting_name, l, globals_dict, at_start=False)
Set or update a setting by adding items to it.
source code
 
get_or_set_default(setting_name, default, globals_dict)
Get or set a default setting from localsettings.
source code
Variables [hide private]
  __package__ = 'expedient.clearinghouse.defaultsettings'
Function Details [hide private]

append_to_local_setting(setting_name, l, globals_dict, at_start=False)

source code 

Set or update a setting by adding items to it.

If a setting with name EXTRA_%s % setting_name exists in localsettings then this function will add append list l to the value of EXTRA_setting_name. The setting in localsettings must be a list. This function will actually set the value in the module, so no need to reset it.

Parameters:
  • setting_name (str) - The name of the setting, to which an "EXTRA_" will be prepended.
  • l (list) - list to append to the setting's value
  • globals_dict (dict) - the globals for the module calling the function
  • at_start (bool) - Should the list be inserted at the start? Default is False
Returns:
the value of the new setting.

get_or_set_default(setting_name, default, globals_dict)

source code 

Get or set a default setting from localsettings.

If the setting with name setting_name is in localsettings, then use that as the default value. Otherwise, use default. This function will actually set the value in the module, so no need to reset it.

Parameters:
  • setting_name (str) - The setting name to be set
  • default (unspecified.) - The dafult value of the setting if not found.
  • globals_dict (dict) - the globals for the module calling the function
Returns:
The value that was set.