def journal_(request): form = request.web_input(journalid="", ignore="", anyway="") rating = define.get_rating(request.userid) journalid = define.get_int(request.matchdict.get('journalid', form.journalid)) try: item = journal.select_view( request.userid, 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(request.userid, canonical_url=canonical_url, title=item["title"]) page.append(define.render('detail/journal.html', [ # Myself profile.select_myself(request.userid), # Journal detail item, # Violations [i for i in macro.MACRO_REPORT_VIOLATION if 3000 <= i[0] < 4000], ])) return Response(define.common_page_end(request.userid, page))
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(template.detail_journal, [ # 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)
def edit_journal_get_(request): form = request.web_input(journalid="", anyway="") form.journalid = define.get_int(form.journalid) detail = journal.select_view(request.userid, ratings.EXPLICIT.code, form.journalid, False, anyway=form.anyway) if request.userid != detail['userid'] and request.userid not in staff.MODS: return Response(define.errorpage(request.userid, errorcode.permission)) return Response(define.webpage(request.userid, "edit/journal.html", [ # Journal detail detail, profile.get_user_ratings(detail['userid']), ]))
def GET(self): form = web.input(journalid="", anyway="") form.journalid = define.get_int(form.journalid) detail = journal.select_view(self.user_id, ratings.EXPLICIT.code, form.journalid, False, anyway=form.anyway) if self.user_id != detail['userid'] and self.user_id not in staff.MODS: return define.errorpage(self.user_id, errorcode.permission) return define.webpage(self.user_id, "edit/journal.html", [ # Journal detail detail, profile.get_user_ratings(detail['userid']), ])
def edit_journal_get_(request): form = request.web_input(journalid="", anyway="") form.journalid = define.get_int(form.journalid) detail = journal.select_view(request.userid, ratings.EXPLICIT.code, form.journalid, False, anyway=form.anyway) if request.userid != detail['userid'] and request.userid not in staff.MODS: raise WeasylError('InsufficientPermissions') return Response(define.webpage(request.userid, "edit/journal.html", [ # Journal detail detail, profile.get_user_ratings(detail['userid']), ], title="Edit Journal"))
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( template.detail_journal, [ # 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)
def GET(self): form = web.input(journalid="", anyway="") form.journalid = define.get_int(form.journalid) detail = journal.select_view(self.user_id, ratings.EXPLICIT.code, form.journalid, False, anyway=form.anyway) if self.user_id != detail['userid'] and self.user_id not in staff.MODS: return define.errorpage(self.user_id, errorcode.permission) return define.webpage( self.user_id, "edit/journal.html", [ # Journal detail detail, profile.get_user_ratings(detail['userid']), ])
def edit_journal_get_(request): form = request.web_input(journalid="", anyway="") form.journalid = define.get_int(form.journalid) detail = journal.select_view(request.userid, ratings.EXPLICIT.code, form.journalid, False, anyway=form.anyway) if request.userid != detail['userid'] and request.userid not in staff.MODS: return Response(define.errorpage(request.userid, errorcode.permission)) return Response( define.webpage( request.userid, "edit/journal.html", [ # Journal detail detail, profile.get_user_ratings(detail['userid']), ]))