diff --git a/classes.py b/classes.py index 4346b37..cc35064 100644 --- a/classes.py +++ b/classes.py @@ -1,8 +1,11 @@ +"""File that combines classes""" + class Article: + """Class symbolizing an article""" def __init__(self, template, title, category="uncategorized"): self.template = template self.title = title - self.category = "uncategorized" if category == None else category + self.category = "uncategorized" if category is None else category def __repr__(self): - return f'Article(title="{self.title}")' \ No newline at end of file + return f'Article(title="{self.title}")' diff --git a/main.py b/main.py index 9ade4c0..31bd9d1 100644 --- a/main.py +++ b/main.py @@ -36,7 +36,7 @@ for article_data in articles_data: if article.template in articles.keys(): raise KeyError(f"Two articles linking to the same template ({article.template})") - + articles[article.template] = article category_list.append(article) categories[category_name] = category_list @@ -49,10 +49,12 @@ for article_data in articles_data: @app.route("/") @app.route("/p") def index(): + """Homepage""" return render_template("home.html", categories=categories.items()) @app.route("/rss") def rss_feed(): + """RSS feed""" pretty = request.args.get("pretty", False, type=bool) response = make_response(fg.rss_str(pretty=pretty), 200) response.mimetype = "application/xml" @@ -60,6 +62,7 @@ def rss_feed(): @app.route("/atom") def atom_feed(): + """Atom feed""" pretty = request.args.get("pretty", False, type=bool) response = make_response(fg.atom_str(pretty=pretty), 200) response.mimetype = "application/xml" @@ -71,10 +74,12 @@ def favicon(): @app.route("/contact") def contact(): + """Contact page""" return render_template("contact.html") @app.route("/p//") def article(article_id:str): + """Render an article""" if not re.match(r'[a-zA-Z0-9-]+', article_id): return ">:(" article = articles[article_id] diff --git a/routes/editor.py b/routes/editor.py index 8568695..2e6d602 100644 --- a/routes/editor.py +++ b/routes/editor.py @@ -1,5 +1,7 @@ -from flask import Blueprint, request, render_template +"""Used for editor/editor's preview""" + import base64 +from flask import Blueprint, request, render_template editor_routes = Blueprint('simple_page', __name__, template_folder='templates') @@ -10,9 +12,10 @@ def editor(): @editor_routes.route("/preview/") @editor_routes.route("/preview/") def preview(b64:str=""): + """Return a preview to show in the editor""" is_real_preview = request.args.get("website", False, type=bool) content = base64.b64decode(b64).decode("utf-8") if is_real_preview: return render_template("editor/demo.html", written=content) - else: - return render_template("editor/preview.html", content=content) \ No newline at end of file + + return render_template("editor/preview.html", content=content)