本文整理汇总了Python中wheezy.http.HTTPResponse.cache_dependency方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPResponse.cache_dependency方法的具体用法?Python HTTPResponse.cache_dependency怎么用?Python HTTPResponse.cache_dependency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wheezy.http.HTTPResponse
的用法示例。
在下文中一共展示了HTTPResponse.cache_dependency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from wheezy.http import HTTPResponse [as 别名]
# 或者: from wheezy.http.HTTPResponse import cache_dependency [as 别名]
def get(self):
con = session()
repo = Repository(con)
CONTENT_TYPE_XML='text/xml'
CONTENT_TYPE_XML_RSP=CONTENT_TYPE_XML+'; charset=utf-8'
if DEBUG:
base_url = 'http://192.168.72.100:8080'
else:
base_url = 'http://shoboi.net'
feed = feedgenerator.Atom1Feed(
title = 'しょぼいろだ。',
link = 'http://shobi.net/',
feed_url = 'http://shoboi.net/atom',
description = u'エロも笑いも虹も惨事もしょぼいろだで共有してね',
author_name=u'しょぼい。',
language = u"ja",
pubdate = datetime.utcnow()
)
upimages = repo.list_upimages()
for idx, i in enumerate(upimages):
feed.add_item(
title = i.title or 'タイトルなし',
link = '%s/detail/%s' % (base_url, i.id),
description = """<![CDATA[
<a href="%s/detail/%s">
<img src="%s/img/%s">
</a>
]]>""" % (base_url, i.id, base_url, i.thumb),
author_name = i.author or '名無し',
pubdate = datetime.now()
)
if idx >= 4: # 5件まで
break;
response = HTTPResponse()
content_type = ('Content-Type', CONTENT_TYPE_XML_RSP)
response.headers[0] = content_type
response.write(feed.writeString('utf-8'))
response.cache_dependency = ('d_atom', )
return response