def index(): '''homepage''' sidebar = { 'status': RDB.get_status(), 'imagestats': RDB.get_imagestats(), 'tagline': next(TAGLINES), } LOGGER.info('index requested') return render_template('main.html', title='fnordpad', image=RDB.random_image(folder='public'), sidebar=sidebar, )
def sort(ressource='unsorted', page=0): imagestats = RDB.get_imagestats(); sortimages = dict() folderimages = list() if ressource in APP.config['CONTENTSUB'].keys(): # folder/rdb match sortimages = RDB.get_sort_images(folder=ressource, page=page) if len(sortimages) == 0 and page != 0: return redirect(url_for('sort', ressource=ressource, page=page-1)) folderimages = RDB.get_dict_images(folder=ressource) elif ressource in RDB.get_all_images(): # file match sortimages[ressource] = RDB.locate_image(ressource) else: return redirect(url_for('sort')) flash('%s left: %i, page: %i' %(ressource, len(folderimages), page)) return render_template('sort.html', title='sort', folderimages=folderimages, sortimages=sortimages, imagestats=imagestats, )