def __init__(self, *args, **kwargs): tornado.web.Application.__init__(self, *args, **kwargs) self.Session, self.engine = model.create_initialize_db(options.db_url) session = self.Session() try: page = model.Page.query(session).first() if page is None: session.add(model.Page(title="Index", content="Sample Page.")) session.commit() time.sleep(0.2) model.Publication.publish(session) session.commit() finally: session.close()
def __init__(self, *args, **kwargs): tornado.web.Application.__init__(self, *args, **kwargs) self.Session, self.engine = model.create_initialize_db(options.db_url) session = self.Session() try: page = model.Page.query(session).first() if page is None: session.add(model.Page(title="Index",content="Sample Page.")) session.commit() time.sleep(0.2) model.Publication.publish(session) session.commit() finally: session.close()
def setUp(self): self._Session, self._engine = create_initialize_db("sqlite://", echo=False) self.session = self._Session()