Example #1
0
    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 '')))
Example #2
0
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 '')))
Example #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,))
Example #4
0
    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, ))