Пример #1
0
def set_location(cursor, event_id, event_place):
    cursor.execute("select id, comparison_name from locations")
    locations = cursor.fetchall()
    for location in locations:
        if utils.same(utils.remove_uneeded(event_place), location[1], 0.2):
            print ("adding new location to event %s" % event_id)
            cursor.execute("update events set id_location = %s where id = %s" % (location[0], event_id))
Пример #2
0
def add_new_location(location_id, comparison_name):
    events = web.select(tables="events", what="id, place", where="id_location is null")
    for event in events:
        if utils.same(utils.remove_uneeded(event.place), comparison_name, 0.2):
            web.debug("adding new location to event %s" % event.id)
            web.query("update events set id_location = %s where id = %s" % (location_id, event.id))