本文整理汇总了Python中post.Post.get_pages方法的典型用法代码示例。如果您正苦于以下问题:Python Post.get_pages方法的具体用法?Python Post.get_pages怎么用?Python Post.get_pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post.Post
的用法示例。
在下文中一共展示了Post.get_pages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def get(self):
db_posts = db.GqlQuery(
"""
SELECT * FROM Post
WHERE type IN ('announcement', 'news')
AND active = TRUE
ORDER BY date
DESC LIMIT 5
"""
)
posts = []
au_tz = pytz.timezone("Australia/Sydney")
utc_tz = pytz.utc
for db_post in db_posts:
post = SimplePost(
db_post.key,
db_post.title,
db_post.author,
utc_tz.localize(db_post.date).astimezone(au_tz),
db_post.content,
)
posts.append(post)
data = {
"upcoming": next_session_widget(8),
"picofday": pic_of_day_widget(),
"posts": posts,
"session": sessions.Session(),
"pages": Post.get_pages(),
}
return self.response.out.write(template.render("index.html", data))
示例2: get
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def get(self):
db_sessions = db.Query(Session).filter('active =',True).order('ordering').fetch(100)
sessions = []
for s in db_sessions:
cur = {
'name' : s.name,
'day_of_week' : s.day_of_week,
'start_time' : s.start_time,
'end_time' : s.end_time,
'location' : s.location,
'quoted_loc' : quote(s.location),
'description' : s.description,
'member_price' : s.member_price,
'casual_price' : s.casual_price,
'courts' : s.courts,
'leader' : s.leader,
'coords' : s.coordinates,
}
if s.leader:
leader_name = s.leader.strip().split(' ')
cur['email'] = get_email(*leader_name[0:2])
else:
cur['email'] = 'holy moly'
sessions.append(cur)
data = {
'pages' : Post.get_pages(),
'session' : util_sess.Session(),
'sessions' : sessions,
}
return self.response.out.write(template.render('session/sessions.html',data))
示例3: __compose
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def __compose(self,name,form,web_sess):
data = {
'pages' : Post.get_pages(),
'session' : web_sess,
'session_form' : form,
'sess_name' : name,
}
return self.response.out.write(template.render('session/edit.html',data))
示例4: _compose
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def _compose(self,flash=[]):
sess = sessions.Session()
sess['flash'] = flash
data = {
'session' : sess,
'pages' : Post.get_pages(),
'files' : File.all().order('path').order('filename').order('extension').fetch(1000)
}
return self.response.out.write(template.render('files/upload.html',data))
示例5: _compose
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def _compose(self,gallery_slug,flash=[]):
gallery = db.Query(Gallery).filter('slug =',gallery_slug).get()
sess = sessions.Session()
sess['flash'] = flash
data = {
'session' : sess,
'pages' : Post.get_pages(),
'title' : gallery.title,
'photos' : [ {'id':photo.key().id(), 'caption':photo.title, 'ext':photo.extension, 'fp':photo.frontpage} for photo in gallery.photos ],
}
return self.response.out.write(template.render('photos/upload.html',data))
示例6: get
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def get(self,gallery):
gallery = db.Query(Gallery).filter("slug =",gallery).get()
data = {
'pages' : Post.get_pages(),
'session' : sessions.Session(),
}
if not gallery:
self.error(404)
return self.response.out.write(template.render('404.html',data))
data['gallery'] = gallery
data['photos'] = [ {'id':photo.key().id(), 'caption':photo.title, 'ext':photo.extension} for photo in gallery.photos ]
self.response.headers['Content-Type'] = "text/xml"
return self.response.out.write(template.render('photos/images.xml',data))
示例7: post
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import get_pages [as 别名]
def post(self,session_slug):
session = db.Query(Session).filter('slug =',session_slug).get()
sess = util_sess.Session()
if not session:
sess['flash'] = ['Session does not exist.']
self.error(404)
data = {
'pages' : Post.get_pages(),
'session' : sess,
}
return self.response.out.write(template.render('404.html',data))
try:
input_data = SessionForm(instance=session,data=self.request.POST)
if input_data.is_valid():
input_data.save()
sess['flash'] = ['Session succesfully saved.']
return self.redirect('/session')
return self.redirect('/session/edit/%s'%session.slug)
else:
sess['flash'] = ['There were errors in your form, see below.']
except db.Error, e:
sess['flash'] = ['Error saving session: %s' % e]