我们从Python开源项目中,提取了以下34个代码示例,用于说明如何使用flask.json_available()。
def content(self): queries = get_queries() if not queries and not is_available(): return self.render('panels/sqlalchemy_error.html', { 'json_available': json_available, 'sqlalchemy_available': sqlalchemy_available, 'extension_used': extension_used(), 'recording_enabled': recording_enabled(), }) data = [] for query in queries: data.append({ 'duration': query.duration, 'sql': format_sql(query.statement, query.parameters), 'signed_query': dump_query(query.statement, query.parameters), 'context_long': query.context, 'context': format_fname(query.context) }) return self.render('panels/sqlalchemy.html', {'queries': data}) # Panel views
def suite(): suite = unittest.TestSuite() if flask.json_available: suite.addTest(unittest.makeSuite(JSONTestCase)) suite.addTest(unittest.makeSuite(SendfileTestCase)) suite.addTest(unittest.makeSuite(LoggingTestCase)) suite.addTest(unittest.makeSuite(NoImportsTestCase)) suite.addTest(unittest.makeSuite(StreamingTestCase)) return suite
def is_available(): return (json_available and sqlalchemy_available and extension_used() and recording_enabled())