本文整理汇总了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 ])
示例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"