mirror of
https://github.com/MathiasDPX/blog.git
synced 2025-05-10 07:33:09 +00:00
fix: pylint
This commit is contained in:
parent
761e6d810a
commit
836b91aa67
1 changed files with 10 additions and 8 deletions
12
main.py
12
main.py
|
@ -1,15 +1,18 @@
|
|||
import json
|
||||
import re
|
||||
import os
|
||||
from flask import Flask, render_template, request, send_file, make_response
|
||||
from routes.editor import editor_routes
|
||||
from feedgen.feed import FeedGenerator
|
||||
from dotenv import load_dotenv
|
||||
from routes.editor import editor_routes
|
||||
from classes import *
|
||||
import json, re, os
|
||||
load_dotenv()
|
||||
|
||||
app = Flask(__name__)
|
||||
app.register_blueprint(editor_routes)
|
||||
|
||||
articles_data = json.load(open("articles.json", "r", encoding="utf-8"))
|
||||
with open("articles.json", "r", encoding="utf-8") as f:
|
||||
articles_data = json.load(f)
|
||||
categories = {} # Category name:str -> [Article]
|
||||
articles = {} # ID:str = Article
|
||||
|
||||
|
@ -23,7 +26,6 @@ fg.description("Blog RSS feed")
|
|||
|
||||
for article_data in articles_data:
|
||||
category_name = article_data.get("category", "Uncategorized")
|
||||
|
||||
category_list = categories.get(category_name, [])
|
||||
|
||||
article = Article(
|
||||
|
@ -32,7 +34,7 @@ for article_data in articles_data:
|
|||
category=category_name
|
||||
)
|
||||
|
||||
if article.template in list(articles.keys()):
|
||||
if article.template in articles.keys():
|
||||
raise KeyError(f"Two articles linking to the same template ({article.template})")
|
||||
|
||||
articles[article.template] = article
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue