def get_db(self):
"""Return the app global db connection or create one."""
db = getattr(g, '_database', None)
if db is None:
db = g._database = self.connect_to_db()
db.row_factory = sqlite3.Row
return db
评论列表
文章目录