def submit_journal_post_(request): form = request.web_input(title="", rating="", friends="", members="", 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") j = orm.Journal() j.title = form.title j.rating = rating j.content = form.content journalid = journal.create(request.userid, j, friends_only=form.friends, tags=tags) raise HTTPSeeOther(location="/journal/%i/%s" % (journalid, slug_for(form.title)))
def POST(self): form = web.input(title="", rating="", friends="", members="", 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") j = orm.Journal() j.title = form.title j.rating = rating j.content = form.content journalid = journal.create(self.user_id, j, friends_only=form.friends, tags=tags) raise web.seeother("/journal/%i/%s" % (journalid, slug_for(form.title)))
def edit_journal_post_(request): form = request.web_input(journalid="", title="", rating="", friends="", content="") rating = ratings.CODE_MAP.get(define.get_int(form.rating)) if not rating: raise WeasylError("ratingInvalid") j = orm.Journal() j.journalid = define.get_int(form.journalid) j.title = form.title j.rating = rating j.content = form.content journal.edit(request.userid, j, friends_only=form.friends) raise HTTPSeeOther(location="/journal/%i/%s%s" % ( define.get_int(form.journalid), slug_for(form.title), ("?anyway=true" if request.userid in staff.MODS else '') ))
def POST(self): form = web.input(journalid="", title="", rating="", friends="", content="") rating = ratings.CODE_MAP.get(define.get_int(form.rating)) if not rating: raise WeasylError("ratingInvalid") j = orm.Journal() j.journalid = define.get_int(form.journalid) j.title = form.title j.rating = rating j.content = form.content journal.edit(self.user_id, j, friends_only=form.friends) raise web.seeother( "/journal/%i/%s%s" % (define.get_int(form.journalid), slug_for(form.title), ("?anyway=true" if self.user_id in staff.MODS else '')))