removed old rss functions

This commit is contained in:
IDK 2021-08-02 10:56:50 +03:00
parent 27b8fee9b7
commit 35d5d43eeb
5 changed files with 2 additions and 106 deletions

View File

@ -1,56 +0,0 @@
alembic==1.6.5
astroid==2.6.2
Babel==2.9.1
blinker==1.4
certifi==2021.5.30
chardet==4.0.0
click==8.0.1
cracklib==2.9.3
dnspython==2.1.0
dominate==2.6.0
email-validator==1.1.3
Flask==2.0.1
Flask-Babel==2.0.0
Flask-Bootstrap==3.3.7.1
Flask-Login==0.5.0
Flask-Mail==0.9.1
Flask-Migrate==3.0.1
Flask-Moment==1.0.1
Flask-SQLAlchemy==2.5.1
Flask-WTF==0.15.1
greenlet==1.1.0
html2text==2020.1.16
icalendar==4.0.7
idna==2.10
importlib-metadata==4.6.1
isort==5.9.2
itsdangerous==2.0.1
Jinja2==3.0.1
lazy-object-proxy==1.6.0
Mako==1.1.4
MarkupSafe==2.0.1
mccabe==0.6.1
Pillow==8.3.1
pkg-resources==0.0.0
psycopg2==2.9.1
PyJWT==2.1.0
pylint==2.9.3
pylint-flask-sqlalchemy==0.2.0
PyRSS2Gen==1.1
python-dateutil==2.8.1
python-dotenv==0.18.0
python-editor==1.0.4
pytz==2021.1
reportlab==3.5.68
requests==2.25.1
six==1.16.0
SQLAlchemy==1.4.20
toml==0.10.2
typed-ast==1.4.3
typing-extensions==3.10.0.0
urllib3==1.26.6
visitor==0.1.3
Werkzeug==2.0.1
wrapt==1.12.1
WTForms==2.3.3
zipp==3.5.0

View File

@ -50,9 +50,7 @@ def index_html(context, REQUEST=None, showcodes=0, showsemtable=0):
H = []
# News:
# 2020-12-30: abandonne l'icon rss
# rssicon = scu.icontag("rssscodoc_img", title="Flux RSS", border="0")
H.append(sco_news.scolar_news_summary_html(context)) # , rssicon=rssicon))
H.append(sco_news.scolar_news_summary_html(context))
# Avertissement de mise à jour:
H.append(sco_up_to_date.html_up_to_date_box(context))

View File

@ -37,7 +37,6 @@ from email.mime.text import MIMEText
from email.header import Header
from operator import itemgetter
import six
import PyRSS2Gen # pylint: disable=import-error
from flask_login import current_user
@ -140,7 +139,6 @@ def scolar_news_summary(context, n=5):
n["date822"] = n["date"].strftime("%a, %d %b %Y %H:%M:%S %z")
# heure
n["hm"] = n["date"].strftime("%Hh%M")
n["rssdate"] = n["date"].strftime("%d/%m %Hh%M") # pour affichage
for k in n.keys():
if n[k] is None:
n[k] = ""
@ -197,14 +195,12 @@ def _get_formsemestre_infos_from_news(context, n):
return {"formsemestre_id": formsemestre_id, "sem": sem, "descr_sem": descr_sem}
def scolar_news_summary_html(context, n=5, rssicon=None):
def scolar_news_summary_html(context, n=5):
"""News summary, formated in HTML"""
news = scolar_news_summary(context, n=n)
if not news:
return ""
H = ['<div class="news"><span class="newstitle">Dernières opérations']
if rssicon: # 2020-12-30 plus utilisé
H.append('<a href="rssnews">' + rssicon + "</a>")
H.append('</span><ul class="newslist">')
for n in news:
@ -230,34 +226,6 @@ def scolar_news_summary_html(context, n=5, rssicon=None):
return "\n".join(H)
def scolar_news_summary_rss(context, title, sco_url, n=5):
"""rss feed for scolar news"""
news = scolar_news_summary(context, n=n)
items = []
for n in news:
text = safehtml.convert_html_to_text(n["text"])
items.append(
PyRSS2Gen.RSSItem(
title=six.text_type("%s %s" % (n["rssdate"], text), SCO_ENCODING),
link=sco_url + "/" + n["url"],
pubDate=n["date822"],
)
)
rss = PyRSS2Gen.RSS2(
title=six.text_type(title, SCO_ENCODING),
link=sco_url,
description=six.text_type(title, SCO_ENCODING),
lastBuildDate=datetime.datetime.now(),
items=items,
)
f = StringIO()
rss.write_xml(f, encoding=SCO_ENCODING)
f.seek(0)
data = f.read()
f.close()
return data
def _send_news_by_mail(n):
"""Notify by email"""
context = None # #context

View File

@ -257,19 +257,6 @@ def index_html(context, REQUEST=None, showcodes=0, showsemtable=0):
)
@bp.route("/rssnews")
@permission_required(Permission.ScoView)
@scodoc7func(context)
def rssnews(context, REQUEST=None):
"rss feed"
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
return sco_news.scolar_news_summary_rss(
context,
"Nouvelles de " + sco_preferences.get_preference("DeptName"),
scu.ScoURL(),
)
sco_publish(
"/trombino", sco_trombino.trombino, Permission.ScoView, methods=["GET", "POST"]
)

View File

@ -43,7 +43,6 @@ pycparser==2.20
pydot==1.4.2
pyOpenSSL==20.0.1
pyparsing==2.4.7
PyRSS2Gen==1.1
pytest==6.2.4
python-dateutil==2.8.2
python-dotenv==0.18.0