예제 #1
0
 def render_GET(self, request):
     board_name = request.get_argument("name")
     board = get_board(request, board_name)
     if not can_write(request, board):
         raise Unauthorized()
     context = {"board": board}
     return render_template("article_write.html", request, context)
예제 #2
0
파일: article.py 프로젝트: Perlmint/Yuzuki
 def render_POST(self, request):
     board_name = request.get_argument("name")
     board = get_board(request, board_name)
     if not can_write(request, board):
         raise Unauthorized()
     subject = request.get_argument("subject")
     content = request.get_argument("content")
     # no empty subject
     if subject.strip():
         article = create_article(request, board, subject, content)
         request.dbsession.add(article)
         request.dbsession.commit()
         request.redirect("/article/view?id=%s" % article.uid)
         return "article posted"
     else:
         raise BadRequest()
예제 #3
0
파일: board.py 프로젝트: Perlmint/Yuzuki
 def render_GET(self, request):
     name = request.get_argument("name")
     if not (name == "notice" or is_anybody(request)):
         raise Unauthorized()
     page = request.get_argument_int("page", 1)
     board = get_board(request, name)
     articles = get_article_page(request, board, page)
     total_article_count = board.article_count
     page_total = total_article_count / ARTICLE_PER_PAGE
     if total_article_count % ARTICLE_PER_PAGE != 0:
         page_total = total_article_count / ARTICLE_PER_PAGE + 1
     context = {
         "items": articles,
         "board": board,
         "page": page,
         "page_total": page_total,
         "can_write": can_write(request, board),
     }
     return render_template("board.html", request, context)