Exemplo n.º 1
0
def get_dynamic_setting(db, name):
    """
    Gets a setting that can be altered dynamically by Snowball (i.e. a non-user
    defined setting)
    """
    try:
        settings = db[model.settings_key()]
        return settings[name]
    except KeyError:
        return None
Exemplo n.º 2
0
def save_dynamic_setting(db, name, value):
    """Sets a dynamic setting (i.e. a non-user defined setting)"""
    settings_ident = scarecrow.ident(model.settings_key())
    
    try:
        settings = db[settings_ident]
    except KeyError:
        settings = model.Storage()
        settings.type = 'settings'
    
    settings[name] = value
    db[settings_ident] = settings