Exemple #1
0
def init_appdata(store, result, appdata_dict):
    # Drop old appdata
    store.find(models.ApplicationData).remove()

    # Initialize the default data table evry time with
    # fresh data and fresh translations
    appdata = models.ApplicationData()
    appdata.fields = appdata_dict['fields']
    appdata.version = appdata_dict['version']
    store.add(appdata)
Exemple #2
0
def db_init_appdata(store):
    # Load new appdata
    appdata_dict = load_appdata()

    # Drop old appdata
    store.find(models.ApplicationData).remove()

    # Load and setup new appdata
    store.add(models.ApplicationData(appdata_dict))

    return appdata_dict
Exemple #3
0
def do_appdata_init(store):
    try:
        appdata = store.find(models.ApplicationData).one()

        if not appdata:
            raise Exception

    except Exception:
        appdata = models.ApplicationData()
        source = load_appdata()
        appdata.version = source['version']
        appdata.fields = source['fields']
        store.add(appdata)
Exemple #4
0
def db_update_appdata(store):
    # Load new appdata
    appdata_dict = load_appdata()

    # Drop old appdata
    store.find(models.ApplicationData).remove()

    # Load and setup new appdata
    store.add(models.ApplicationData(appdata_dict))

    load_default_questionnaires(store)
    load_default_fields(store)

    return appdata_dict
Exemple #5
0
def do_appdata_init(store):

    try:
        appdata = store.find(models.ApplicationData).one()

        if not appdata:
            raise Exception

    except Exception as xxx:
        appdata = models.ApplicationData()
        source = opportunistic_appdata_init()
        appdata.version = source['version']
        appdata.fields = source['fields']
        store.add(appdata)

    fo = Fields()
    fo.noisy = True
    fo.default_fields(appdata.fields)
    (unique_fields, localized_fields) = fo.extensive_dump()

    return unique_fields, localized_fields