示例#1
0
def api_messages_submissions_(request):
    form = request.web_input(count=0, backtime=0, nexttime=0)
    try:
        count = int(form.count)
        backtime = int(form.backtime)
        nexttime = int(form.nexttime)
    except ValueError:
        raise HTTPUnprocessableEntity(json=_ERROR_UNEXPECTED)
    else:
        count = min(count or 100, 100)

    submissions = message.select_submissions(request.userid,
                                             count + 1,
                                             include_tags=True,
                                             backtime=backtime,
                                             nexttime=nexttime)
    backtime, nexttime = d.paginate(submissions, backtime, nexttime, count,
                                    'unixtime')

    ret = []
    for sub in submissions:
        tidy_submission(sub)
        ret.append(sub)

    return {
        'backtime': backtime,
        'nexttime': nexttime,
        'submissions': ret,
    }
示例#2
0
文件: api.py 项目: weykent/weasyl
    def GET(self):
        form = web.input(count=0, backtime=0, nexttime=0)
        try:
            count = int(form.count)
            backtime = int(form.backtime)
            nexttime = int(form.nexttime)
        except ValueError:
            web.ctx.status = '422 Unprocessable Entity'
            return json.dumps(_ERROR_UNEXPECTED)
        else:
            count = min(count or 100, 100)

        submissions = message.select_submissions(
            self.user_id, count + 1, backtime=backtime, nexttime=nexttime)
        backtime, nexttime = d.paginate(submissions, backtime, nexttime, count, 'unixtime')

        ret = []
        for sub in submissions:
            tidy_submission(sub)
            ret.append(sub)

        return json.dumps({
            'backtime': backtime, 'nexttime': nexttime,
            'submissions': ret,
        })
示例#3
0
文件: messages.py 项目: 0x15/weasyl
    def GET(self):
        form = web.input(feature="", backtime=None, nexttime=None)

        define._page_header_info.refresh(self.user_id)
        return define.webpage(self.user_id, "message/submissions_thumbnails.html", [
            # Feature
            form.feature,
            # Submissions
            message.select_submissions(self.user_id, 66,
                                       backtime=define.get_int(form.backtime), nexttime=define.get_int(form.nexttime)),
        ])
示例#4
0
文件: messages.py 项目: Weasyl/weasyl
def messages_submissions_(request):
    form = request.web_input(feature="", backtime=None, nexttime=None)

    define._page_header_info.refresh(request.userid)
    return Response(define.webpage(request.userid, "message/submissions_thumbnails.html", [
        # Feature
        form.feature,
        # Submissions
        message.select_submissions(request.userid, 66, include_tags=False,
                                   backtime=define.get_int(form.backtime), nexttime=define.get_int(form.nexttime)),
    ]))
示例#5
0
    def GET(self):
        form = web.input(feature="", backtime=None, nexttime=None)

        define._page_header_info.refresh(self.user_id)
        return define.webpage(
            self.user_id,
            "message/submissions_thumbnails.html",
            [
                # Feature
                form.feature,
                # Submissions
                message.select_submissions(
                    self.user_id,
                    66,
                    backtime=define.get_int(form.backtime),
                    nexttime=define.get_int(form.nexttime)),
            ])
示例#6
0
def messages_submissions_(request):
    form = request.web_input(feature="", backtime=None, nexttime=None)

    define._page_header_info.refresh(request.userid)
    return Response(
        define.webpage(
            request.userid,
            "message/submissions_thumbnails.html",
            [
                # Feature
                form.feature,
                # Submissions
                message.select_submissions(
                    request.userid,
                    66,
                    include_tags=False,
                    backtime=define.get_int(form.backtime),
                    nexttime=define.get_int(form.nexttime)),
            ]))
示例#7
0
文件: api.py 项目: Weasyl/weasyl
def api_messages_submissions_(request):
    form = request.web_input(count=0, backtime=0, nexttime=0)
    try:
        count = int(form.count)
        backtime = int(form.backtime)
        nexttime = int(form.nexttime)
    except ValueError:
        raise HTTPUnprocessableEntity(json=_ERROR_UNEXPECTED)
    else:
        count = min(count or 100, 100)

    submissions = message.select_submissions(
        request.userid, count + 1, include_tags=True, backtime=backtime, nexttime=nexttime)
    backtime, nexttime = d.paginate(submissions, backtime, nexttime, count, 'unixtime')

    ret = []
    for sub in submissions:
        tidy_submission(sub)
        ret.append(sub)

    return {
        'backtime': backtime, 'nexttime': nexttime,
        'submissions': ret,
    }