aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2014-06-09 14:04:38 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2014-06-09 15:15:25 +0200
commit16ec162838eb8ab891f5b04351bb202d84a2b834 (patch)
tree975f0b567f48604f976adf35ba62f8a536a5ab16 /pyaggr3g470r/views.py
parentsupporting feed without date or with ill formated date (diff)
downloadnewspipe-16ec162838eb8ab891f5b04351bb202d84a2b834.tar.gz
newspipe-16ec162838eb8ab891f5b04351bb202d84a2b834.tar.bz2
newspipe-16ec162838eb8ab891f5b04351bb202d84a2b834.zip
making pyagregator runnable by apache
* adding bootstrap module for basic import * redoing logging (config, proper use of the logging module) * making secret part of config (random wouldn't work with apache since it uses different instances of python) * making server entry point not executing application if just imported * not writing file for opml when we can read it from memory
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index eda9c399..1dd651e5 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -152,6 +152,7 @@ def login():
return redirect(url_for('home'))
return render_template('login.html', form=form)
+
@app.route('/logout/')
@login_required
def logout():
@@ -298,14 +299,14 @@ def article(article_id=None):
if not article.readed:
article.readed = True
db.session.commit()
-
+
previous_article = article.previous_article()
if previous_article is None:
previous_article = article.source.articles[0]
next_article = article.next_article()
if next_article is None:
next_article = article.source.articles[-1]
-
+
return render_template('article.html', head_title=utils.clear_string(article.title),
article=article,
previous_article=previous_article, next_article=next_article)
@@ -558,12 +559,10 @@ def management():
if not allowed_file(data.filename):
flash(gettext('File not allowed.'), 'danger')
else:
- opml_path = os.path.join("./pyaggr3g470r/var/", data.filename)
- data.save(opml_path)
try:
- nb = utils.import_opml(g.user.email, opml_path)
+ nb = utils.import_opml(g.user.email, data.read())
flash(str(nb) + ' ' + gettext('feeds imported.'), "success")
- except Exception as e:
+ except:
flash(gettext("Impossible to import the new feeds."), "danger")
elif None != request.files.get('jsonfile', None):
# Import an account
bgstack15