Exemplo n.º 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
Exemplo n.º 2
0
 def __len__(self):
     return len(Setting.as_dict())
Exemplo n.º 3
0
 def __iter__(self):
     return iter(Setting.as_dict())
Exemplo n.º 4
0
 def __getitem__(self, key):
     return Setting.as_dict()[key]