示例#1
0
 def GET(self):
     user = users.get_current_user()
     if user and users.is_current_user_admin():
         posts = models.get_all_posts()
         return render.admin(user.nickname(), posts)
     else:
         raise web.redirect(users.create_login_url('/admin'))
示例#2
0
def recent_feed():
    feed = AtomFeed('Recente', feed_url=request.url, url=request.url_root)
    articles = get_all_posts()[:config.FEEDS_MAX_POSTS]
    for article in articles:
        feed.add(article.title,
                 content=unicode(article.get_content()),
                 content_type='html',
                 author='<your name here>',
                 url=article.url,
                 updated=article.get_datetime(),
                 published=article.get_datetime())
    return feed.get_response()
示例#3
0
文件: blog.py 项目: diogum/dirtyblog
def recent_feed():
    feed = AtomFeed('Recente', feed_url=request.url, url=request.url_root)
    articles = get_all_posts()[:config.FEEDS_MAX_POSTS]
    for article in articles:
        feed.add(article.title,
                 content=unicode(article.get_content()),
                 content_type='html',
                 author='<your name here>',
                 url=article.url,
                 updated=article.get_datetime(),
                 published=article.get_datetime())
    return feed.get_response()
示例#4
0
 def get(self):
     user = users.get_current_user()
     if user:
         email = user.email()
         auth_url = users.create_logout_url(dest_url='/')
     else:
         email = None
         auth_url = users.create_login_url(dest_url='/')
     self.response.write(
         jinja_environment.get_template('index.html').render(
             email=email,
             is_admin=users.is_current_user_admin(),
             auth_url=auth_url,
             posts=models.get_all_posts()))
示例#5
0
def posts_list():
    posts = get_all_posts()
    return render_template('all_posts.html', posts=posts)
示例#6
0
文件: blog.py 项目: diogum/dirtyblog
def post(post_url):
    actual_post = get_post_by_url(post_url)
    return render_template('post.html', post=actual_post, menu_posts=get_all_posts())
示例#7
0
文件: blog.py 项目: diogum/dirtyblog
def books():
    return render_template('books.html', menu_posts=get_all_posts())
示例#8
0
文件: blog.py 项目: diogum/dirtyblog
def about():
    return render_template('about.html', menu_posts=get_all_posts())
示例#9
0
文件: blog.py 项目: diogum/dirtyblog
def index():
    return render_template('index.html', posts=get_all_posts()[:config.HOME_MAX_POSTS], menu_posts=get_all_posts())
示例#10
0
def post(post_url):
    actual_post = get_post_by_url(post_url)
    return render_template('post.html',
                           post=actual_post,
                           menu_posts=get_all_posts())
示例#11
0
def books():
    return render_template('books.html', menu_posts=get_all_posts())
示例#12
0
def about():
    return render_template('about.html', menu_posts=get_all_posts())
示例#13
0
def index():
    return render_template('index.html',
                           posts=get_all_posts()[:config.HOME_MAX_POSTS],
                           menu_posts=get_all_posts())
示例#14
0
 def GET(self):
     ''' Get all the posts '''
     posts = models.get_all_posts()
     return render.archive(posts)