def run_all(cls, conf): top_module_name = conf['package_name'] # You need to create this, thank you. WD-rpw 03-10-2010 mod = __import__(top_module_name + ".websetup.bootstrap_data", fromlist=[top_module_name, "websetup"]) for modname in dir(mod): if modname.startswith("bootstrap"): fully_qualified_mod_name = "%s.websetup.bootstrap_data.%s" % (top_module_name, modname) dmigration = DataMigration(fully_qualified_mod_name) if dmigration.migration_needs_to_run(): mod = sys.modules[ fully_qualified_mod_name ] mod.upgrade(conf) DBSession.add(dmigration) transaction.commit()
def setUp(self): """Prepare model test fixture.""" try: new_attrs = {} new_attrs.update(self.attrs) new_attrs.update(self.do_get_dependencies()) self.obj = self.klass(**new_attrs) DBSession.add(self.obj) DBSession.flush() return self.obj except: DBSession.rollback() raise