Example #1
0
def populate_settings(app):
    """
    Populates the settings with defaults from the app config.
    Settings that are already set will not be overridden.

    Args:
        app: The Flask app object.

    """

    for setting in app.config['DEFAULT_SETTINGS']:
        if setting['key'] not in app.config['SETTINGS'].keys():
            setting = Setting(**setting)
            setting.save()
    app.config['SETTINGS']['installed'] = True
Example #2
0
 def __len__(self):
     return len(Setting.as_dict())
Example #3
0
 def __iter__(self):
     return iter(Setting.as_dict())
Example #4
0
 def __getitem__(self, key):
     return Setting.as_dict()[key]