Beispiel #1
0
 def get(self):
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     self.put_page('templates/list_comments.html', {
         'comments': base.comments_for_client(comment.PendingComment.all()),
         'path': 'approvecomment',
         'clearall': True,
     })
Beispiel #2
0
def single_post(view):
    try:
        post = models.post.by_id(view.request.get('p'))
        if post.private and not models.user.user(view).admin:
            return base.raise_forbidden(view)
        view.put_page('post.html', {
            'page_title': utils.escape.esc_title_plain(post.title),
            'post': utils.escape.client_post(post),
        })
    except ValueError:
        base.raise_not_found(view)
Beispiel #3
0
 def get(self):
     p = self.request_value('page', int)
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     self.put_page('templates/list_comments.html', {
         'comments': base.comments_for_client(models.comment.fetch(p)),
         'path': 'delcomment',
         'current_page': p,
         'page_count': xrange(models.comment.count_pages()),
     })
Beispiel #4
0
 def get(self):
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     self.put_page(
         'templates/list_comments.html', {
             'comments': base.comments_for_client(
                 comment.PendingComment.all()),
             'path': 'approvecomment',
             'clearall': True,
         })
Beispiel #5
0
 def get(self):
     p = self.request_value('page', int)
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     self.put_page(
         'templates/list_comments.html', {
             'comments': base.comments_for_client(models.comment.fetch(p)),
             'path': 'delcomment',
             'current_page': p,
             'page_count': xrange(models.comment.count_pages()),
         })
Beispiel #6
0
 def post(self):
     if not model.User.get_by_session(self.request).admin:
         return base.raise_forbidden(self)
     conf = model.SiteConfiguration.load()
     conf.title = self.request.get('title').strip()
     conf.style = self.request.get('style').strip()
     conf.rss_uri = self.request.get('rss_uri').strip()
     conf.rss_description = self.request.get('rss_description').strip()
     conf.analytics_code = self.request.get('analytics_code').strip()
     conf.analytics_domain = self.request.get('analytics_domain').strip()
     conf.post_html = self.request.get('post_html').strip()
     model.SiteConfiguration.save(conf)
     model.Blogroll.add_by_text(self.request.get('blogrolls').strip())
     self.redirect('/c/siteconf')
Beispiel #7
0
 def post(self):
     if not model.User.get_by_session(self.request).admin:
         return base.raise_forbidden(self)
     conf = model.SiteConfiguration.load()
     conf.title = self.request.get('title').strip()
     conf.style = self.request.get('style').strip()
     conf.rss_uri = self.request.get('rss_uri').strip()
     conf.rss_description = self.request.get('rss_description').strip()
     conf.analytics_code = self.request.get('analytics_code').strip()
     conf.analytics_domain = self.request.get('analytics_domain').strip()
     conf.post_html = self.request.get('post_html').strip()
     model.SiteConfiguration.save(conf)
     model.Blogroll.add_by_text(self.request.get('blogrolls').strip())
     self.redirect('/c/siteconf')
Beispiel #8
0
 def post(self):
     if not admin.User.get_by_session(self.request).admin:
         return base.raise_forbidden(self)
     post_id = self.request.get('id')
     p = None
     try:
         p = models.post.by_id(post_id)
     except ValueError:
         p = models.post.new()
         post_id = str(p.pid)
     p.title = self.request.get('title')
     p.content = self.request.get('content')
     tags = self.request.get('tags')
     models.post.put(p, [s.strip() for s in tags.split(',')])
     self.redirect('/?p=' + post_id)
Beispiel #9
0
 def get(self):
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     comment.PendingComment.clear()
     self.redirect('/c/pendingcomments')
Beispiel #10
0
 def post(self):
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     comment.PendingComment.get_by_id(int(self.request.get('id'))).approve()
Beispiel #11
0
 def get(self):
     if not model.User.get_by_session(self.request).admin:
         return base.raise_forbidden(self)
     self.put_page('templates/siteconf.html')
Beispiel #12
0
 def get(self):
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     comment.PendingComment.clear()
     self.redirect('/c/pendingcomments')
Beispiel #13
0
 def post(self):
     usr = admin.User.get_by_session(self.request)
     if not usr.admin:
         return base.raise_forbidden(self)
     comment.PendingComment.get_by_id(int(self.request.get('id'))).approve()
Beispiel #14
0
 def get(self):
     if not model.User.get_by_session(self.request).admin:
         return base.raise_forbidden(self)
     self.put_page('templates/siteconf.html')