コード例 #1
0
ファイル: index.py プロジェクト: davinnovation/Yuzuki
 def render_GET(self, request):
     content = StringIO()
     with open("page/index") as f:
         md.convertFile(f, content, "utf-8")
         context = {
             "site_description": SITE_DESCRIPTION,
             "content": content.getvalue().decode("utf-8"),
             "is_index": True,
         }
     return render_template("page.html", request, context)
コード例 #2
0
ファイル: page.py プロジェクト: davinnovation/Yuzuki
 def render_GET(self, request):
     if len(request.path.split("/")) != 3:
         raise BadRequest()
     name = request.path.split("/")[2]
     if not name:
         raise BadRequest()
     file_path = "page/%s" % name
     if not os.path.isfile(file_path):
         raise PageNotFound()
     with open(file_path) as f:
         content = StringIO()
         md.convertFile(f, content, "utf-8")
         context = {
             "content": content.getvalue().decode("utf-8"),
         }
         return render_template("page.html", request, context)