• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python define.get_int函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中weasyl.define.get_int函数的典型用法代码示例。如果您正苦于以下问题:Python get_int函数的具体用法?Python get_int怎么用?Python get_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: followed_

def followed_(request):
    cachename = "user/followed.html"

    form = request.web_input(userid="", name="", backid=None, nextid=None)
    form.name = request.matchdict.get('name', form.name)
    form.userid = define.get_int(form.userid)

    otherid = profile.resolve(request.userid, form.userid, form.name)

    if not otherid:
        raise WeasylError("userRecordMissing")
    elif not request.userid and "h" in define.get_config(otherid):
        return Response(define.errorpage(request.userid, errorcode.no_guest_access))

    userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)

    return Response(define.webpage(request.userid, cachename, [
        # Profile information
        userprofile,
        # User information
        profile.select_userinfo(otherid, config=userprofile['config']),
        # Relationship
        profile.select_relation(request.userid, otherid),
        # Followed
        followuser.select_followed(request.userid, otherid, limit=44,
                                   backid=define.get_int(form.backid), nextid=define.get_int(form.nextid)),
    ]))
开发者ID:Syfaro,项目名称:weasyl,代码行数:27,代码来源:profile.py


示例2: GET

    def GET(self, name=""):
        cachename = "user/followed.html"

        form = web.input(userid="", name="", backid=None, nextid=None)
        form.name = name if name else form.name
        form.userid = define.get_int(form.userid)

        otherid = profile.resolve(self.user_id, form.userid, form.name)

        if not otherid:
            raise WeasylError("userRecordMissing")
        elif not self.user_id and "h" in define.get_config(otherid):
            return define.errorpage(self.user_id, errorcode.no_guest_access)

        userprofile = profile.select_profile(otherid, images=True, viewer=self.user_id)

        return define.webpage(self.user_id, cachename, [
            # Profile information
            userprofile,
            # User information
            profile.select_userinfo(otherid, config=userprofile['config']),
            # Relationship
            profile.select_relation(self.user_id, otherid),
            # Followed
            followuser.select_followed(self.user_id, otherid, limit=44,
                                       backid=define.get_int(form.backid), nextid=define.get_int(form.nextid)),
        ])
开发者ID:0x15,项目名称:weasyl,代码行数:27,代码来源:profile.py


示例3: _create_char

def _create_char(userid, x1, y1, x2, y2, charid, config=None, remove=True):
    x1, y1, x2, y2 = d.get_int(x1), d.get_int(y1), d.get_int(x2), d.get_int(y2)
    filename = d.url_make(charid, "char/.thumb", root=True)
    if not m.os.path.exists(filename):
        filename = d.url_make(charid, "char/cover", root=True)
        if not filename:
            return
        remove = False

    im = image.read(filename)
    size = im.size.width, im.size.height

    d.execute("""
        UPDATE character
        SET settings = REGEXP_REPLACE(settings, '-.', '') || '-%s'
        WHERE charid = %i
    """, [image.image_setting(im), charid])
    dest = os.path.join(d.get_character_directory(charid), '%i.thumb%s' % (charid, images.image_extension(im)))

    bounds = None
    if image.check_crop(size, x1, y1, x2, y2):
        bounds = geometry.Rectangle(x1, y1, x2, y2)
    thumb = images.make_thumbnail(im, bounds)
    thumb.write(dest, format=images.image_file_type(thumb))
    if remove:
        os.remove(filename)
开发者ID:Syfaro,项目名称:weasyl,代码行数:26,代码来源:thumbnail.py


示例4: GET

    def GET(self, journalid=""):
        form = web.input(journalid="", ignore="", anyway="")

        rating = define.get_rating(self.user_id)
        journalid = define.get_int(journalid) if journalid else define.get_int(form.journalid)

        try:
            item = journal.select_view(
                self.user_id, rating, journalid,
                ignore=define.text_bool(form.ignore, True), anyway=form.anyway
            )
        except WeasylError as we:
            if we.value in ("UserIgnored", "TagBlocked"):
                we.errorpage_kwargs['links'] = [
                    ("View Journal", "?ignore=false"),
                    ("Return to the Home Page", "/index"),
                ]
            raise

        canonical_url = "/journal/%d/%s" % (journalid, slug_for(item["title"]))

        page = define.common_page_start(self.user_id, options=["pager"], canonical_url=canonical_url, title=item["title"])
        page.append(define.render('detail/journal.html', [
            # Myself
            profile.select_myself(self.user_id),
            # Journal detail
            item,
            # Violations
            [i for i in macro.MACRO_REPORT_VIOLATION if 3000 <= i[0] < 4000],
        ]))

        return define.common_page_end(self.user_id, page)
开发者ID:hyena,项目名称:weasyl,代码行数:32,代码来源:detail.py


示例5: edit_character_post_

def edit_character_post_(request):
    form = request.web_input(charid="", title="", age="", gender="", height="",
                             weight="", species="", rating="", content="", friends="")

    rating = ratings.CODE_MAP.get(define.get_int(form.rating))
    if not rating:
        raise WeasylError("ratingInvalid")

    c = orm.Character()
    c.charid = define.get_int(form.charid)
    c.age = form.age
    c.gender = form.gender
    c.height = form.height
    c.weight = form.weight
    c.species = form.species
    c.char_name = form.title
    c.content = form.content
    c.rating = rating

    character.edit(request.userid, c, friends_only=form.friends)
    raise HTTPSeeOther(location="/character/%i/%s%s" % (
        define.get_int(form.charid),
        slug_for(form.title),
        ("?anyway=true" if request.userid in staff.MODS else '')
    ))
开发者ID:makyo,项目名称:weasyl,代码行数:25,代码来源:content.py


示例6: submit_literary_post_

def submit_literary_post_(request):
    form = request.web_input(submitfile="", coverfile="boop", thumbfile="", title="",
                             folderid="", subtype="", rating="", friends="", critique="",
                             content="", tags="", embedlink="")

    tags = searchtag.parse_tags(form.tags)

    if not define.config_read_bool("allow_submit"):
        raise WeasylError("FeatureDisabled")

    rating = ratings.CODE_MAP.get(define.get_int(form.rating))
    if not rating:
        raise WeasylError("ratingInvalid")

    s = orm.Submission()
    s.title = form.title
    s.rating = rating
    s.content = form.content
    s.folderid = define.get_int(form.folderid) or None
    s.subtype = define.get_int(form.subtype)

    submitid, thumb = submission.create_literary(
        request.userid, s, embedlink=form.embedlink, friends_only=form.friends, tags=tags,
        coverfile=form.coverfile, thumbfile=form.thumbfile, submitfile=form.submitfile,
        critique=form.critique, create_notifications=('nonotification' not in form))
    if thumb:
        raise HTTPSeeOther(location="/manage/thumbnail?submitid=%i" % (submitid,))
    else:
        raise HTTPSeeOther(location="/submission/%i/%s" % (submitid, slug_for(form.title)))
开发者ID:makyo,项目名称:weasyl,代码行数:29,代码来源:content.py


示例7: POST

    def POST(self):
        form = web.input(submitfile="", thumbfile="", title="", folderid="",
                         subtype="", rating="", friends="", critique="", content="",
                         tags="", imageURL="")

        tags = searchtag.parse_tags(form.tags)

        if not define.config_read_bool("allow_submit"):
            raise WeasylError("FeatureDisabled")

        rating = ratings.CODE_MAP.get(define.get_int(form.rating))
        if not rating:
            raise WeasylError("ratingInvalid")

        s = orm.Submission()
        s.title = form.title
        s.rating = rating
        s.content = form.content
        s.folderid = define.get_int(form.folderid) or None
        s.subtype = define.get_int(form.subtype)

        submitid = submission.create_visual(
            self.user_id, s, friends_only=form.friends, tags=tags,
            imageURL=form.imageURL, thumbfile=form.thumbfile, submitfile=form.submitfile,
            critique=form.critique, create_notifications=('nonotification' not in form))

        if 'customthumb' in form:
            raise web.seeother("/manage/thumbnail?submitid=%i" % (submitid,))
        else:
            raise web.seeother("/submission/%i/%s" % (submitid, slug_for(form.title)))
开发者ID:0x15,项目名称:weasyl,代码行数:30,代码来源:content.py


示例8: manage_thumbnail_get_

def manage_thumbnail_get_(request):
    form = request.web_input(submitid="", charid="", auto="")
    submitid = define.get_int(form.submitid)
    charid = define.get_int(form.charid)

    if submitid and request.userid not in staff.ADMINS and request.userid != define.get_ownerid(submitid=submitid):
        return Response(define.errorpage(request.userid, errorcode.permissions))
    elif charid and request.userid not in staff.ADMINS and request.userid != define.get_ownerid(charid=charid):
        return Response(define.errorpage(request.userid, errorcode.permissions))
    elif not submitid and not charid:
        return Response(define.errorpage(request.userid))

    if charid:
        source_path = define.url_make(charid, "char/.thumb", root=True)
        if os.path.exists(source_path):
            source = define.url_make(charid, "char/.thumb")
        else:
            source = define.url_make(charid, "char/cover")
    else:
        try:
            source = thumbnail.thumbnail_source(submitid)['display_url']
        except WeasylError:
            source = None

    return Response(define.webpage(request.userid, "manage/thumbnail.html", [
        # Feature
        "submit" if submitid else "char",
        # Targetid
        define.get_targetid(submitid, charid),
        # Thumbnail
        source,
        # Exists
        bool(source),
    ], options=['imageselect'], title="Select Thumbnail"))
开发者ID:Weasyl,项目名称:weasyl,代码行数:34,代码来源:settings.py


示例9: GET

    def GET(self, charid=""):
        form = web.input(charid="", ignore="", anyway="")

        rating = define.get_rating(self.user_id)
        charid = define.get_int(charid) if charid else define.get_int(form.charid)

        try:
            item = character.select_view(
                self.user_id, charid, rating,
                ignore=define.text_bool(form.ignore, True), anyway=form.anyway
            )
        except WeasylError as we:
            if we.value in ("UserIgnored", "TagBlocked"):
                we.errorpage_kwargs['links'] = [
                    ("View Character", "?ignore=false"),
                    ("Return to the Home Page", "/index"),
                ]
            raise

        canonical_url = "/character/%d/%s" % (charid, slug_for(item["title"]))

        page = define.common_page_start(self.user_id, canonical_url=canonical_url, title=item["title"])
        page.append(define.render(template.detail_character, [
            # Profile
            profile.select_myself(self.user_id),
            # Character detail
            item,
            # Violations
            [i for i in macro.MACRO_REPORT_VIOLATION if 2000 <= i[0] < 3000],
        ]))

        return define.common_page_end(self.user_id, page)
开发者ID:0x15,项目名称:weasyl,代码行数:32,代码来源:detail.py


示例10: control_movefolder_

def control_movefolder_(request):
    form = request.web_input(folderid="", parentid="")
    form.folderid = define.get_int(form.folderid)

    if form.folderid and define.get_int(form.parentid) >= 0:
        folder.move(request.userid, form)
    raise HTTPSeeOther(location="/manage/folders")
开发者ID:charmander,项目名称:weasyl,代码行数:7,代码来源:settings.py


示例11: POST

    def POST(self):
        form = web.input(folderid="", parentid="")
        form.folderid = define.get_int(form.folderid)

        if form.folderid and define.get_int(form.parentid) >= 0:
            folder.move(self.user_id, form)
        raise web.seeother("/manage/folders")
开发者ID:0x15,项目名称:weasyl,代码行数:7,代码来源:settings.py


示例12: GET

    def GET(self):
        form = web.input(feature="", backid="", nextid="")
        form.backid = define.get_int(form.backid)
        form.nextid = define.get_int(form.nextid)

        return define.webpage(self.user_id, "manage/ignore.html", [
            ignoreuser.select(self.user_id, 20, backid=form.backid, nextid=form.nextid),
        ])
开发者ID:0x15,项目名称:weasyl,代码行数:8,代码来源:settings.py


示例13: manage_ignore_

def manage_ignore_(request):
    form = request.web_input(feature="", backid="", nextid="")
    form.backid = define.get_int(form.backid)
    form.nextid = define.get_int(form.nextid)

    return Response(define.webpage(request.userid, "manage/ignore.html", [
        ignoreuser.select(request.userid, 20, backid=form.backid, nextid=form.nextid),
    ]))
开发者ID:charmander,项目名称:weasyl,代码行数:8,代码来源:settings.py


示例14: submission_

def submission_(request):
    username = request.matchdict.get('name')
    submitid = request.matchdict.get('submitid')

    form = request.web_input(submitid="", ignore="", anyway="")

    rating = define.get_rating(request.userid)
    submitid = define.get_int(submitid) if submitid else define.get_int(form.submitid)

    extras = {
        "pdf": True,
    }

    if define.user_is_twitterbot():
        extras['twitter_card'] = submission.twitter_card(submitid)

    try:
        item = submission.select_view(
            request.userid, submitid, rating,
            ignore=define.text_bool(form.ignore, True), anyway=form.anyway
        )
    except WeasylError as we:
        we.errorpage_kwargs = extras
        if 'twitter_card' in extras:
            extras['options'] = ['nocache']
        if we.value in ("UserIgnored", "TagBlocked"):
            extras['links'] = [
                ("View Submission", "?ignore=false"),
                ("Return to the Home Page", "/index"),
            ]
        raise

    login = define.get_sysname(item['username'])
    canonical_path = request.route_path('submission_detail_profile', name=login, submitid=submitid, slug=slug_for(item['title']))

    if request.GET.get('anyway'):
        canonical_path += '?anyway=true'

    if login != username:
        raise httpexceptions.HTTPMovedPermanently(location=canonical_path)
    extras["canonical_url"] = canonical_path
    extras["title"] = item["title"]

    page = define.common_page_start(request.userid, **extras)
    page.append(define.render('detail/submission.html', [
        # Myself
        profile.select_myself(request.userid),
        # Submission detail
        item,
        # Subtypes
        macro.MACRO_SUBCAT_LIST,
        # Violations
        [i for i in macro.MACRO_REPORT_VIOLATION if 2000 <= i[0] < 3000],
    ]))

    return Response(define.common_page_end(request.userid, page))
开发者ID:Syfaro,项目名称:weasyl,代码行数:56,代码来源:detail.py


示例15: messages_submissions_

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)),
    ]))
开发者ID:Weasyl,项目名称:weasyl,代码行数:11,代码来源:messages.py


示例16: submit_report_

def submit_report_(request):
    form = request.web_input(submitid="", charid="", journalid="", reportid="", violation="", content="")

    report.create(request.userid, form)
    if form.reportid:
        raise HTTPSeeOther(location="/modcontrol/report?reportid=%s" % (form.reportid,))
    elif define.get_int(form.submitid):
        raise HTTPSeeOther(location="/submission/%i" % (define.get_int(form.submitid),))
    elif define.get_int(form.charid):
        raise HTTPSeeOther(location="/character/%i" % (define.get_int(form.charid),))
    else:
        raise HTTPSeeOther(location="/journal/%i" % (define.get_int(form.journalid),))
开发者ID:makyo,项目名称:weasyl,代码行数:12,代码来源:content.py


示例17: manage_friends_

def manage_friends_(request):
    form = request.web_input(feature="", backid="", nextid="")
    form.backid = define.get_int(form.backid)
    form.nextid = define.get_int(form.nextid)

    if form.feature == "pending":
        return Response(define.webpage(request.userid, "manage/friends_pending.html", [
            frienduser.select_requests(request.userid, 20, backid=form.backid, nextid=form.nextid),
        ]))
    else:
        return Response(define.webpage(request.userid, "manage/friends_accepted.html", [
            # Friends
            frienduser.select_accepted(request.userid, 20, backid=form.backid, nextid=form.nextid),
        ]))
开发者ID:charmander,项目名称:weasyl,代码行数:14,代码来源:settings.py


示例18: create

def create(userid, x1, y1, x2, y2, auto=False, config=None):
    x1, y1, x2, y2 = d.get_int(x1), d.get_int(y1), d.get_int(x2), d.get_int(y2)
    db = d.connect()
    im = db.query(orm.MediaItem).get(avatar_source(userid)['mediaid']).as_image()
    file_type = image.image_file_type(im)
    bounds = None
    size = im.size.width, im.size.height
    if not auto and image.check_crop(size, x1, y1, x2, y2):
        bounds = geometry.Rectangle(x1, y1, x2, y2)
    thumb = image.shrinkcrop(im, geometry.Size(100, 100), bounds)
    media_item = orm.fetch_or_create_media_item(
        thumb.to_buffer(format=file_type), file_type=file_type, im=thumb)
    orm.UserMediaLink.make_or_replace_link(userid, 'avatar', media_item)
    orm.UserMediaLink.clear_link(userid, 'avatar-source')
开发者ID:Syfaro,项目名称:weasyl,代码行数:14,代码来源:avatar.py


示例19: create

def create(userid, form):
    form.submitid = d.get_int(form.submitid)
    form.charid = d.get_int(form.charid)
    form.journalid = d.get_int(form.journalid)
    form.violation = d.get_int(form.violation)
    form.content = form.content.strip()[:_CONTENT]

    # get the violation type from allowed types
    try:
        vtype = next(x for x in m.MACRO_REPORT_VIOLATION if x[0] == form.violation)
    except StopIteration:
        raise WeasylError("Unexpected")

    if not form.submitid and not form.charid and not form.journalid:
        raise WeasylError("Unexpected")
    elif form.violation == 0:
        if userid not in staff.MODS:
            raise WeasylError("Unexpected")
    elif (form.submitid or form.charid) and not 2000 <= form.violation < 3000:
        raise WeasylError("Unexpected")
    elif form.journalid and not 3000 <= form.violation < 4000:
        raise WeasylError("Unexpected")
    elif vtype[3] and not form.content:
        raise WeasylError("ReportCommentRequired")

    query = d.execute(
        "SELECT userid, settings FROM %s WHERE %s = %i",
        ["submission", "submitid", form.submitid] if form.submitid else
        ["character", "charid", form.charid] if form.charid else
        ["journal", "journalid", form.journalid],
        options="single")

    if not query or (form.violation != 0 and 'h' in query[1]):
        raise WeasylError("TargetRecordMissing")

    now = arrow.get()
    target_dict = _dict_of_targetid(form.submitid, form.charid, form.journalid)
    report = Report.query.filter_by(is_closed=False, **target_dict).first()
    if report is None:
        if form.violation == 0:
            raise WeasylError("Unexpected")
        urgency = vtype[1]
        report = Report(urgency=urgency, opened_at=now, **target_dict)
        Report.dbsession.add(report)

    Report.dbsession.add(ReportComment(
        report=report, violation=form.violation, userid=userid, unixtime=now, content=form.content))

    Report.dbsession.flush()
开发者ID:Syfaro,项目名称:weasyl,代码行数:49,代码来源:report.py


示例20: control_removefolder_

def control_removefolder_(request):
    form = request.web_input(folderid="")
    form.folderid = define.get_int(form.folderid)

    if form.folderid:
        folder.remove(request.userid, form.folderid)
    raise HTTPSeeOther(location="/manage/folders")
开发者ID:charmander,项目名称:weasyl,代码行数:7,代码来源:settings.py



注:本文中的weasyl.define.get_int函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python define.get_rating函数代码示例发布时间:2022-05-26
下一篇:
Python define.get_config函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap