Commit cf25e9e8 authored by shadMod's avatar shadMod 💬

replaced for loop with GetNews().get_all_files_counter()

parent 8d3afb08
...@@ -20,6 +20,7 @@ import toml ...@@ -20,6 +20,7 @@ import toml
import flask import flask
from uitwww import cache from uitwww import cache
from .src.news.utils import GetNews
def get_pages_list(app, base=None, level=0): def get_pages_list(app, base=None, level=0):
...@@ -79,8 +80,8 @@ def prepare_blueprint(app): ...@@ -79,8 +80,8 @@ def prepare_blueprint(app):
data_path = os.path.expanduser(os.path.abspath("data")) data_path = os.path.expanduser(os.path.abspath("data"))
def list_news(): def list_news():
news_path = os.path.join(data_path, "news", "2023") nw_cl = GetNews(os.path.join(app.instance_path, "news"))
_list_news = [x.replace('.md', '') for x in os.listdir(news_path)[:4]] _list_news = nw_cl.get_all_files_counter(4)
return _list_news return _list_news
def list_distro(): def list_distro():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment