def close_db(error): '''Closes the database again at the end of the request.''' if hasattr(g, 'sqlite_db'): g.sqlite_db.close() debug('Database connection destroyed.')