示例#1
0
文件: app.py 项目: whywrd/notheme
def subdomain_likes(subdomain, page_number=1):
    info_params = blog_method_params.InfoParams()
    info_params.blog_identifier = subdomain
    info_params.api_key = app.config[OAuthC.CONSUMER_KEY]
    info_request = blog_methods.InfoQuery(info_params)
    info_resp = flask.g.request_handler.query(info_request)
    info_resp = info_resp[request_handlers.JSON]

    likes_params = blog_method_params.LikesParams()
    likes_params.blog_identifier = subdomain
    likes_params.api_key = app.config[OAuthC.CONSUMER_KEY]
    likes_params.limit = POST_LIMIT
    likes_params.offset = (page_number - 1) * POST_LIMIT
    likes_params.reblog_info = True
    likes_params.notes_info = False
    likes_request = blog_methods.LikesQuery(likes_params)
    likes_resp = flask.g.request_handler.query(likes_request)
    likes_resp = likes_resp[request_handlers.JSON]

    page = likes_page.LikesPage(info_resp, likes_resp)
    navigation = nav.Navigation(page_number,
                                POST_LIMIT,
                                likes_resp[RespC.Response.LIKED_COUNT],
                                Rc.Subdomains.LIKES,
                                subdomain=subdomain)

    return flask.render_template('pages/post_pages/subdomain_posts.html',
                                 page=page,
                                 navigation=navigation)
示例#2
0
文件: app.py 项目: whywrd/notheme
def user_following(page_number=1):
    if not flask.session.get(SeshC.LOGGED_IN, False):
        return flask.redirect(flask.url_for(Rc.Authorization.AUTHORIZE))

    params = user_method_params.FollowingParams()
    params.limit = FOLLOWING_LIMIT
    params.offset = (page_number - 1) * FOLLOWING_LIMIT
    request = user_methods.FollowingQuery(params)
    resp = flask.g.request_handler.query(request)
    resp = resp[request_handlers.JSON]

    page = info_pages.FollowingPage(resp)
    navigation = nav.Navigation(page_number, FOLLOWING_LIMIT,
                                resp[RespC.Response.TOTAL_BLOGS],
                                Rc.User.FOLLOWING)
    return flask.render_template('pages/info_pages/following.html',
                                 page=page,
                                 navigation=navigation)
示例#3
0
文件: app.py 项目: whywrd/notheme
def followers(subdomain, page_number=1):
    if not flask.session.get(SeshC.LOGGED_IN, False):
        return flask.redirect(flask.url_for(Rc.Authorization.AUTHORIZE))

    params = blog_method_params.FollowersParams()
    params.blog_identifier = subdomain
    params.limit = FOLLOWERS_LIMIT
    params.offset = (page_number - 1) * FOLLOWERS_LIMIT
    request = blog_methods.FollowersQuery(params)
    resp = flask.g.request_handler.query(request)
    resp = resp[request_handlers.JSON]

    page = info_pages.FollowersPage(resp)
    navigation = nav.Navigation(page_number,
                                FOLLOWERS_LIMIT,
                                resp[RespC.Response.TOTAL_USERS],
                                Rc.Subdomains.FOLLOWERS,
                                subdomain=subdomain)
    return flask.render_template('pages/info_pages/followers.html',
                                 page=page,
                                 navigation=navigation)
示例#4
0
文件: app.py 项目: whywrd/notheme
def subdomain_posts(subdomain, post_type='', page_number=1):
    params = blog_method_params.PostsParams()
    params.blog_identifier = subdomain
    params.api_key = app.config[OAuthC.CONSUMER_KEY]
    params.post_type = post_type
    params.limit = POST_LIMIT
    params.offset = (page_number - 1) * POST_LIMIT
    params.reblog_info = True
    params.notes_info = False
    request = blog_methods.PostsQuery(params)
    resp = flask.g.request_handler.query(request)
    resp = resp[request_handlers.JSON]
    page = post_pages.SubdomainPostPage(resp, post_type=post_type)
    navigation = nav.Navigation(page_number,
                                POST_LIMIT,
                                resp[RespC.Response.TOTAL_POSTS],
                                Rc.Subdomains.POSTS_PAGE,
                                post_type=post_type,
                                subdomain=subdomain)

    return flask.render_template('pages/post_pages/subdomain_posts.html',
                                 page=page,
                                 navigation=navigation)
示例#5
0
文件: app.py 项目: whywrd/notheme
def dashboard(post_type=None, page_number=1):
    if not flask.session.get(SeshC.LOGGED_IN, False):
        return flask.redirect(flask.url_for(Rc.Authorization.AUTHORIZE))

    params = user_method_params.DashboardParams()
    params.post_type = post_type
    params.limit = POST_LIMIT
    params.offset = (page_number - 1) * POST_LIMIT
    params.reblog_info = True
    params.notes_info = False
    request = user_methods.DashboardQuery(params)
    resp = flask.g.request_handler.query(request)
    resp = resp[request_handlers.JSON]

    page = post_pages.DashboardPostPage(resp)
    navigation = nav.Navigation(page_number,
                                POST_LIMIT,
                                None,
                                Rc.User.DASHBOARD,
                                post_type=post_type)

    return flask.render_template('pages/post_pages/dashboard.html',
                                 page=page,
                                 navigation=navigation)