def initTestingDB(): engine = create_engine('sqlite://') Base.metadata.create_all(engine) DBSession.configure(bind=engine) #with transaction.manager: # model = Page('FrontPage', 'This is the front page') # DBSession.add(model) return DBSession
def initTestingDB(): engine = create_engine('sqlite://') Base.metadata.create_all(engine) DBSession.configure(bind=engine) #with transaction.manager: # model = Page('FrontPage', 'This is the front page') # DBSession.add(model) return DBSession
def main(argv=sys.argv): if len(argv) < 2: usage(argv) config_uri = argv[1] options = parse_vars(argv[2:]) setup_logging(config_uri) settings = get_appsettings(config_uri, options=options) engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.create_all(engine)
def main(argv=sys.argv): if len(argv) < 2: usage(argv) config_uri = argv[1] options = parse_vars(argv[2:]) setup_logging(config_uri) settings = get_appsettings(config_uri, options=options) engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.create_all(engine)
def setUp(self): self.config = testing.setUp() from sqlalchemy import create_engine engine = create_engine('sqlite://') from ode.models import ( Base, MyModel, ) DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: model = MyModel(name='one') DBSession.add(model)
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.bind = engine config = Configurator(settings=settings) config.include('cornice') config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.add_renderer('json', 'ode.renderers.JsonRenderer') config.add_renderer('csv', 'ode.renderers.CsvRenderer') config.add_renderer('ical', 'ode.renderers.IcalRenderer') config.add_renderer('no_content', 'ode.renderers.NoContentRenderer') config.add_cornice_deserializer('text/calendar', icalendar_extractor) config.add_cornice_deserializer(COLLECTION_JSON_MIMETYPE, json_extractor) config.add_cornice_deserializer('text/csv', csv_extractor) config.add_translation_dirs('colander:locale/', 'ode:locale/') config.scan(ignore='ode.tests') return config.make_wsgi_app()