本文整理匯總了Python中commit.Commit.gets方法的典型用法代碼示例。如果您正苦於以下問題:Python Commit.gets方法的具體用法?Python Commit.gets怎麽用?Python Commit.gets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類commit.Commit
的用法示例。
在下文中一共展示了Commit.gets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: app
# 需要導入模塊: from commit import Commit [as 別名]
# 或者: from commit.Commit import gets [as 別名]
def app(environ, start_response):
""" try
http://localhost:8887
http://localhost:8887/?{path}
"""
status = '200 OK'
headers = []
path = environ['RAW_URI']
[path, query] = (path.split('?') if '?' in path
else [path, None])
if path.endswith('.js'):
headers.append(('content-type', 'application/javascript'))
headers.append(('content-encoding', 'gzip'))
buffer = StringIO()
start_response(status, headers)
content = open('..' + path).read()
with gzip.GzipFile(mode='wb', compresslevel=6,
fileobj=buffer) as f:
f.write(content)
return [buffer.getvalue()]
headers.append(('content-type', 'text/html'))
start_response(status, headers)
data = generate_graph_data(Commit.gets(query or root))
return engine.render('index.html', {'data': data})