Esempio n. 1
0
def update_record(row_update, rows):
    if row_update:
        from_row, to_row, updated_dict = row_update[0]['from_row'], row_update[
            0]['to_row'], row_update[0]['updated']
        for i in range(from_row, to_row + 1):
            for k, v in updated_dict.items():
                uuid = rows[i]['id']
                if k == 'id' and v == "":
                    datasource.delete(uuid)
                else:
                    datasource.update(uuid, k, v)
    return datasource.data_from_backend().to_dict('records')
Esempio n. 2
0
                dictionary[k] = v
        try:
            pkgver = '{pkgname}-{version}_{revision}'.format(**dictionary)
        except KeyError:
            continue
        dictionary['pkgver'] = pkgver
        dictionary['source-revisions'] = dictionary['pkgname']
        template_json = datasource.to_json(dictionary)
        if 'restricted' in dictionary:
            if dictionary['restricted'] == 'yes':
                dictionary['restricted'] = True
            source.create(datasource.PackageRow(
                pkgname=pkgname,
                pkgver=pkgver,
                arch='unknown-unknown',
                restricted=dictionary['restricted'],
                templatedata=template_json,
                mainpkg=pkgname,
                repo=''
            ), dates=[today, tomorrow])
        else:
            source.update(
                pkgname=pkgname,
                pkgver=pkgver,
                set_templatedata=template_json
            )


if __name__ == '__main__':
    datasource.update(lambda x: build_db(x, sys.argv[1:]))