当前位置: 首页>>代码示例>>Python>>正文


Python Request.hdf方法代码示例

本文整理汇总了Python中trac.web.api.Request.hdf方法的典型用法代码示例。如果您正苦于以下问题:Python Request.hdf方法的具体用法?Python Request.hdf怎么用?Python Request.hdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.web.api.Request的用法示例。


在下文中一共展示了Request.hdf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _test_import

# 需要导入模块: from trac.web.api import Request [as 别名]
# 或者: from trac.web.api.Request import hdf [as 别名]
 def _test_import(self, env, filename, sheet = 1):
     req = Request({'SERVER_PORT': 0, 'SERVER_NAME': 'any', 'wsgi.url_scheme': 'any', 'wsgi.input': 'any', 'REQUEST_METHOD': 'GET' }, lambda x, y: _printme)
     try:
        from trac.test import MockPerm
        req.perm = MockPerm()
     except ImportError:
        pass
     req.authname = 'testuser'
     req.hdf = HDFWrapper([]) # replace by this if you want to generate HTML: req.hdf = HDFWrapper(loadpaths=chrome.get_all_templates_dirs())
     db = env.get_db_cnx()
     cursor = db.cursor()
     _exec(cursor, "select * from enum")
     enums_before = cursor.fetchall()
     _exec(cursor, "select * from component")
     components_before = cursor.fetchall()
     #print enums_before
     # when testing, always use the same time so that the results are comparable
     #print "importing " + filename + " with tickettime " + str(ImporterTestCase.TICKET_TIME)
     template, content_type = ImportModule(env)._do_import(filename, sheet, req, filename, ImporterTestCase.TICKET_TIME)
     #sys.stdout = tempstdout
     #req.display(template, content_type or 'text/html')
     #open('/tmp/out.html', 'w').write(req.hdf.render(template, None))
     _exec(cursor, "select * from ticket")
     tickets = cursor.fetchall()
     _exec(cursor, "select * from ticket_custom")
     tickets_custom = cursor.fetchall()
     _exec(cursor, "select * from ticket_change")
     tickets_change = cursor.fetchall()
     _exec(cursor, "select * from enum")
     enums = [f for f in set(cursor.fetchall()) - set(enums_before)]
     _exec(cursor, "select * from component")
     components = [f for f in set(cursor.fetchall()) - set(components_before)]
     pp = pprint.PrettyPrinter(indent=4)
     return pp.pformat([ tickets, tickets_custom, tickets_change, enums, components ])
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:36,代码来源:test.py

示例2: _test_preview

# 需要导入模块: from trac.web.api import Request [as 别名]
# 或者: from trac.web.api.Request import hdf [as 别名]
 def _test_preview(self, env, filename):
     req = Request({'SERVER_PORT': 0, 'SERVER_NAME': 'any', 'wsgi.url_scheme': 'any', 'wsgi.input': 'any', 'REQUEST_METHOD': 'GET' }, lambda x, y: _printme)
     try:
        from trac.test import MockPerm
        req.perm = MockPerm()
     except ImportError:
        pass
     req.authname = 'testuser'
     req.hdf = HDFWrapper([]) # replace by this if you want to generate HTML: req.hdf = HDFWrapper(loadpaths=chrome.get_all_templates_dirs())
     template, content_type = ImportModule(env)._do_preview(filename, 1, req)
     #sys.stdout = tempstdout
     #req.display(template, content_type or 'text/html')
     #open('/tmp/out.html', 'w').write(req.hdf.render(template, None))
     return str(req.hdf) + "\n"
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:16,代码来源:test.py


注:本文中的trac.web.api.Request.hdf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。