from findlib import MediaObject, HtmlMenu, createdbsession, appconfig, BaseObject, LocationObject from flask import Flask, render_template, request, send_file, flash, redirect, url_for from models import Locations, Media from forms import BasicForm, MediaForm, LocationsForm from sqlalchemy.orm.exc import NoResultFound from sqlalchemy import func app = Flask(__name__) app.config.from_pyfile('flaskcfg.cfg') app.config.from_envvar('APP_SETTINGS', silent=True) # Read configuration config = appconfig('mediadb.cfg') # Connect to database session = createdbsession(config.get('Database', 'Name'), sqlecho=False, cleardown=False) def chooseobject(option=None, *args): if option == 'media': obj = MediaObject(session, args[0]) elif option == 'location': obj = LocationObject(session, Locations) else: obj = None return obj def createstaticquery(querymodel):
def test_00_config(self): config = appconfig('barcode_test.cfg') assert 'barcode_test.db' in config.get('Database', 'Name')
from findlib import MediaObject, HtmlMenu, createdbsession, appconfig, BaseObject, LocationObject from flask import Flask, render_template, request, send_file, flash, redirect, url_for from models import Locations, Media from forms import BasicForm, MediaForm, LocationsForm from sqlalchemy.orm.exc import NoResultFound from sqlalchemy import func app = Flask(__name__) app.config.from_pyfile('flaskcfg.cfg') app.config.from_envvar('APP_SETTINGS', silent=True) # Read configuration config = appconfig('mediadb.cfg') # Connect to database session = createdbsession(config.get('Database', 'Name'), sqlecho=False, cleardown=False) def chooseobject(option=None, *args): if option == 'media': obj = MediaObject(session, args[0]) elif option == 'location': obj = LocationObject(session, Locations) else: obj = None return obj