コード例 #1
0
ファイル: blog.py プロジェクト: radjah/point-www
def blog_rss():
    if not env.owner or not env.owner.id:
        raise UserNotFound

    if env.owner.type == 'feed':
        raise Forbidden

    plist = posts.recent_blog_posts(env.owner, settings.page_limit, 0)

    feed = PyRSS2Gen.RSS2(
            title="%s@point" % env.owner.login,
            link='http://%s.%s/' % (env.owner.login, settings.domain),
            description="Point.im user's blog")

    for p in plist:
        if 'comment_id' in p and p['comment_id']:
            title='#%s/%s' % (p['post'].id, p['comment_id'])
            link = 'http://%s/%s#%s' % \
                    (settings.domain, p['post'].id, p['comment_id'])
        else:
            title='#%s' % p['post'].id
            link = 'http://%s/%s' % (settings.domain, p['post'].id)

        feed.items.append(PyRSS2Gen.RSSItem(
            author=env.owner.login,
            title=title,
            link=link,
            guid=link,
            pubDate=p['post'].created,
            categories=p['post'].tags,
            description=render_string('/rss-text.html', p=p)
        ))

    return Response(feed.to_xml(), mimetype='application/rss+xml')
コード例 #2
0
def blog_rss():
    if not env.owner or not env.owner.id:
        raise UserNotFound

    if env.owner.type == 'feed':
        raise Forbidden

    plist = posts.recent_blog_posts(env.owner, settings.page_limit, 0)

    feed = PyRSS2Gen.RSS2(title="%s@point" % env.owner.login,
                          link='http://%s.%s/' %
                          (env.owner.login, settings.domain),
                          description="Point.im user's blog")

    for p in plist:
        if 'comment_id' in p and p['comment_id']:
            title = '#%s/%s' % (p['post'].id, p['comment_id'])
            link = 'http://%s/%s#%s' % \
                    (settings.domain, p['post'].id, p['comment_id'])
        else:
            title = '#%s' % p['post'].id
            link = 'http://%s/%s' % (settings.domain, p['post'].id)

        feed.items.append(
            PyRSS2Gen.RSSItem(author=env.owner.login,
                              title=title,
                              link=link,
                              guid=link,
                              pubDate=p['post'].created,
                              categories=p['post'].tags,
                              description=render_string('/rss-text.html',
                                                        p=p)))

    return Response(feed.to_xml(), mimetype='application/rss+xml')
コード例 #3
0
ファイル: blog.py プロジェクト: radjah/point-www
def all_posts_rss():
    plist = posts.select_posts(private=False, author_private=False,
                               deny_anonymous=False, blacklist=True,
                               limit=settings.page_limit*4)

    feed = PyRSS2Gen.RSS2(
            title="Point.im",
            link='http://%s/' % (settings.domain),
            description="Point.im")

    for p in plist:
        if 'comment_id' in p and p['comment_id']:
            title='#%s/%s' % (p['post'].id, p['comment_id'])
            link = 'http://%s/%s#%s' % \
                    (settings.domain, p['post'].id, p['comment_id'])
        else:
            title='#%s' % p['post'].id
            link = 'http://%s/%s' % (settings.domain, p['post'].id)

        feed.items.append(PyRSS2Gen.RSSItem(
            author=env.owner.login,
            title=title,
            link=link,
            guid=link,
            pubDate=p['post'].created,
            categories=p['post'].tags,
            description=render_string('/rss-text.html', p=p)
        ))

    return Response(feed.to_xml(), mimetype='application/rss+xml')
コード例 #4
0
def all_posts_rss():
    plist = posts.select_posts(private=False,
                               author_private=False,
                               deny_anonymous=False,
                               blacklist=True,
                               limit=settings.page_limit * 4)

    feed = PyRSS2Gen.RSS2(title="Point.im",
                          link='http://%s/' % (settings.domain),
                          description="Point.im")

    for p in plist:
        if 'comment_id' in p and p['comment_id']:
            title = '#%s/%s' % (p['post'].id, p['comment_id'])
            link = 'http://%s/%s#%s' % \
                    (settings.domain, p['post'].id, p['comment_id'])
        else:
            title = '#%s' % p['post'].id
            link = 'http://%s/%s' % (settings.domain, p['post'].id)

        feed.items.append(
            PyRSS2Gen.RSSItem(author=env.owner.login,
                              title=title,
                              link=link,
                              guid=link,
                              pubDate=p['post'].created,
                              categories=p['post'].tags,
                              description=render_string('/rss-text.html',
                                                        p=p)))

    return Response(feed.to_xml(), mimetype='application/rss+xml')
コード例 #5
0
ファイル: www.py プロジェクト: Igelko/point-core
 def _fn(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except UserNotFound:
         body = render_string('/user-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except PostAuthorError:
         body = render_string('/blog-denied.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except SubscribeError:
         body = render_string('/post-denied.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except PostReadonlyError:
         body = render_string('/post-readonly.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except PostNotFound:
         body = render_string('/post-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except CommentNotFound:
         body = render_string('/comment-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except NotAuthorized:
         raise Forbidden
     except AlreadyAuthorized:
         raise Forbidden
     except PostLimitError:
         body = render_string('/post-interval-exceeded.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
コード例 #6
0
ファイル: www.py プロジェクト: Raegdan/point-core
 def _fn(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except UserNotFound:
         body = render_string('/user-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except PostAuthorError:
         body = render_string('/blog-denied.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
     except SubscribeError:
         body = render_string('/post-denied.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
     except PostNotFound:
         body = render_string('/post-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except CommentNotFound:
         body = render_string('/comment-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except NotAuthorized:
         raise Forbidden
     except AlreadyAuthorized:
         raise Forbidden
     except PostLimitError:
         body = render_string('/post-interval-exceeded.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
コード例 #7
0
 def _fn(*args, **kwargs):
     try:
         try:
             return fn(*args, **kwargs)
         except Exception as e:
             if settings.debug:
                 log.error(traceback.format_exc())
             raise e
     except UserNotFound:
         body = render_string('/user-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except PostAuthorError:
         body = render_string('/blog-denied.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
     except SubscribeError:
         body = render_string('/post-denied.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
     except PostReadonlyError:
         body = render_string('/post-readonly.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
     except PostNotFound:
         body = render_string('/post-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except CommentNotFound:
         body = render_string('/comment-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except CommentEditingForbiddenError:
         body = render_string('/comment-past-editing.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
     except NotAuthorized:
         raise Forbidden
     except AlreadyAuthorized:
         raise Forbidden
     except PostLimitError:
         body = render_string('/post-interval-exceeded.html')
         return Response(body,
                         code=Forbidden.code,
                         message=Forbidden.message)
コード例 #8
0
ファイル: www.py プロジェクト: isqua-test/point-core
 def _fn(*args, **kwargs):
     try:
         try:
             return fn(*args, **kwargs)
         except Exception as e:
             if settings.debug:
                 log.error(traceback.format_exc())
             raise e
     except UserNotFound:
         body = render_string('/user-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except PostAuthorError:
         body = render_string('/blog-denied.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except SubscribeError:
         body = render_string('/post-denied.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except PostReadonlyError:
         body = render_string('/post-readonly.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except PostNotFound:
         body = render_string('/post-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except CommentNotFound:
         body = render_string('/comment-not-found.html')
         return Response(body, code=NotFound.code, message=NotFound.message)
     except CommentEditingForbiddenError:
         body = render_string('/comment-past-editing.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)
     except NotAuthorized:
         raise Forbidden
     except AlreadyAuthorized:
         raise Forbidden
     except PostLimitError:
         body = render_string('/post-interval-exceeded.html')
         return Response(body, code=Forbidden.code, message=Forbidden.message)