当前位置: 首页>>代码示例>>Python>>正文


Python Post.get_pages方法代码示例

本文整理汇总了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))
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:32,代码来源:sbugs.py

示例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))
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:33,代码来源:session.py

示例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))        
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:10,代码来源:session.py

示例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))        
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:11,代码来源:files.py

示例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))        
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:13,代码来源:photo.py

示例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))
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:15,代码来源:photo.py

示例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]
开发者ID:cheesun,项目名称:shuttlebugs,代码行数:26,代码来源:session.py


注:本文中的post.Post.get_pages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。