def add_image(photographer, path): with closing(app.get_db()) as db: image = app.Image.fromfile(db, os.path.expanduser(path), photographer.lower().capitalize()) image.store(db) day = app.Day.current(db) app.link_image(db, image, day) db.commit() local('rm %s' % path)
def update_day(): with closing(app.get_db()) as db: # Refresh today day = app.Day.today(db) db.commit()