コード例 #1
0
ファイル: content.py プロジェクト: weykent/weasyl
    def POST(self):
        form = 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(self.user_id, c, friends_only=form.friends)
        raise web.seeother(
            "/character/%i/%s%s" %
            (define.get_int(form.charid), slug_for(form.title),
             ("?anyway=true" if self.user_id in staff.MODS else '')))
コード例 #2
0
ファイル: content.py プロジェクト: taedixon/weasyl
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 '')))
コード例 #3
0
def submit_character_post_(request):
    form = request.web_input(submitfile="", thumbfile="", title="", age="", gender="",
                             height="", weight="", species="", rating="", friends="",
                             content="", tags="")

    tags = searchtag.parse_tags(form.tags)

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

    if not define.is_vouched_for(request.userid):
        raise WeasylError("vouchRequired")

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

    c = orm.Character()
    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

    charid = character.create(request.userid, c, form.friends, tags,
                              form.thumbfile, form.submitfile)
    raise HTTPSeeOther(location="/manage/thumbnail?charid=%i" % (charid,))
コード例 #4
0
ファイル: content.py プロジェクト: weykent/weasyl
    def POST(self):
        form = web.input(submitfile="",
                         thumbfile="",
                         title="",
                         age="",
                         gender="",
                         height="",
                         weight="",
                         species="",
                         rating="",
                         friends="",
                         content="",
                         tags="")

        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")

        c = orm.Character()
        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

        charid = character.create(self.user_id, c, form.friends, tags,
                                  form.thumbfile, form.submitfile)
        raise web.seeother("/manage/thumbnail?charid=%i" % (charid, ))