def on_finish(self): """ peewee的request-hook(请求完成后关闭) :return: """ if not db_mysql.is_closed(): db_mysql.close() return super(BaseRequestHandler, self).on_finish()
def wrapper(*args, **kwargs): db_mysql.connect() method(*args, **kwargs) if not db_mysql.is_closed(): db_mysql.close()