本文整理汇总了Python中entry.Entry.query方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.query方法的具体用法?Python Entry.query怎么用?Python Entry.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry.Entry
的用法示例。
在下文中一共展示了Entry.query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from entry import Entry [as 别名]
# 或者: from entry.Entry import query [as 别名]
def get(self):
# get all the entries
catalogue_name = self.request.get('catalogue_name',
datastore.DEFAULT_CATALOGUE_NAME)
catalogue_query = Entry.query(
ancestor=datastore.create_entry_key(catalogue_name)).order(-Entry.date)
entries = catalogue_query.fetch()
# wrap feed around the entries
xml = '''\
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/">
'''
for entry in entries:
xml = xml + entry.mytoXML(self.request.scheme + '://' + self.request.host)
xml = xml + '</feed>'
# create etree xml doc
#f = StringIO(xml)
doc = etree.XML(xml)
# create transformer from xsl
xsl_file = './styles/bloglist.xsl'
xsl_root = etree.parse(xsl_file)
transformer = etree.XSLT(xsl_root)
result_tree = transformer(doc)
self.response.write(str(result_tree))
示例2: get
# 需要导入模块: from entry import Entry [as 别名]
# 或者: from entry.Entry import query [as 别名]
def get(self):
# get all the entries
catalogue_name = self.request.get('catalogue_name',
datastore.DEFAULT_CATALOGUE_NAME)
catalogue_query = Entry.query(
ancestor=datastore.create_entry_key(catalogue_name)).order(-Entry.date)
entries = catalogue_query.fetch()
# wrap feed around the entries
xml = '''<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/">'''
for entry in entries:
xml = xml + entry.mytoXML(self.request.scheme + '://' + self.request.host)
xml = xml + '''
</feed>'''
# create etree xml doc
#f = StringIO(xml)
doc = etree.XML(xml)
self.response.headers['Content-Type'] = 'text/plain'
self.response.write(xml)