diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-03-03 23:30:16 +0100 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-03-03 23:30:16 +0100 |
commit | 41cb78173636e0f6f463280afdf050583dbdb3dc (patch) | |
tree | 42224fe408d3048f210b565413feb34bfe08940c | |
parent | last fixes (diff) | |
parent | Typo. (diff) | |
download | newspipe-41cb78173636e0f6f463280afdf050583dbdb3dc.tar.gz newspipe-41cb78173636e0f6f463280afdf050583dbdb3dc.tar.bz2 newspipe-41cb78173636e0f6f463280afdf050583dbdb3dc.zip |
Merge remote-tracking branch 'origin/master' into evol/api
Conflicts:
bootstrap.py
pyaggr3g470r/models.py
pyaggr3g470r/notifications.py
pyaggr3g470r/rest.py
-rw-r--r-- | NEWS.rst | 4 | ||||
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | bootstrap.py | 10 | ||||
-rw-r--r-- | conf.py | 2 | ||||
-rw-r--r-- | conf/conf.cfg-sample | 1 | ||||
-rw-r--r-- | documentation/conf.py | 4 | ||||
-rw-r--r-- | documentation/index.rst | 3 | ||||
-rw-r--r-- | documentation/requirements.rst | 16 | ||||
-rw-r--r-- | migrations/versions/1b750a389c22_remove_email_notification_column.py | 25 | ||||
-rw-r--r-- | migrations/versions/4b5c161e1ced_.py | 2 | ||||
-rw-r--r-- | pyaggr3g470r/export.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/forms.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/models/feed.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/notifications.py | 11 | ||||
-rw-r--r-- | pyaggr3g470r/templates/edit_feed.html | 5 | ||||
-rwxr-xr-x | pyaggr3g470r/utils.py | 7 | ||||
-rw-r--r-- | pyaggr3g470r/views/api/feed.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/views/views.py | 3 |
18 files changed, 56 insertions, 45 deletions
@@ -1,5 +1,9 @@ pyAggr3g470r project news +6.2: 2015-02-26 + The system of email notifications for new articles has been removed. + This feature was hardly used. + 6.1: 2015-02-23 Improvements: articles are now identified with the id provided by the RSS/ATOM feed. @@ -6,8 +6,7 @@ Presentation ============ `pyAggr3g470r <https://bitbucket.org/cedricbonhomme/pyaggr3g470r>`_ is a -web-based news aggregator. It can be deployed on Heroku or on a -traditional server. +web-based news aggregator. Features ======== @@ -18,7 +17,6 @@ Features * data liberation: export and import all your account with a JSON file; * export and import feeds with OPML files; * export articles to HTML; -* e-mail notification; * favorite articles; * detection of inactive feeds; * share articles with Google +, Pinboard and reddit; diff --git a/bootstrap.py b/bootstrap.py index c5a86652..5cfd2250 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,18 +1,10 @@ # required imports and code exection for basic functionning import os -import sys -if 'threading' in sys.modules: - raise Exception('threading module loaded before patching!') import conf import logging -if not (conf.WEBSERVER_DEBUG or conf.ON_HEROKU): - import gevent.monkey - gevent.monkey.patch_thread() - - -def set_logging(log_path, log_level=logging.DEBUG, +def set_logging(log_path, log_level=logging.INFO, log_format='%(asctime)s %(levelname)s %(message)s'): logger = logging.getLogger('pyaggr3g470r') formater = logging.Formatter(log_format) @@ -54,7 +54,6 @@ if not ON_HEROKU: WEBSERVER_PORT = int(config.get('webserver', 'port')) WEBSERVER_SECRET = config.get('webserver', 'secret') - NOTIFICATION_ENABLED = int(config.get('notification', 'enabled')) == 1 NOTIFICATION_EMAIL = config.get('notification', 'email') NOTIFICATION_HOST = config.get('notification', 'host') NOTIFICATION_PORT = int(config.get('notification', 'port')) @@ -84,7 +83,6 @@ else: WEBSERVER_PORT = int(os.environ.get('PORT', 5000)) WEBSERVER_SECRET = os.environ.get('SECRET_KEY', None) - NOTIFICATION_ENABLED = True NOTIFICATION_EMAIL = os.environ.get('NOTIFICATION_EMAIL', '') POSTMARK_API_KEY = os.environ.get('POSTMARK_API_KEY', '') diff --git a/conf/conf.cfg-sample b/conf/conf.cfg-sample index 6e4bb7b7..4f1e06c6 100644 --- a/conf/conf.cfg-sample +++ b/conf/conf.cfg-sample @@ -18,7 +18,6 @@ host = 0.0.0.0 port = 5000 secret = a secret only you know [notification] -enabled = 0 email = pyAggr3g470r@no-reply.com host = smtp.googlemail.com port = 465 diff --git a/documentation/conf.py b/documentation/conf.py index b148de9d..00190f45 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -48,9 +48,9 @@ copyright = u'2015, Cédric Bonhomme' # built documents. # # The short X.Y version. -version = '6.0' +version = '6.2' # The full version, including alpha/beta/rc tags. -release = '6.0' +release = '6.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/documentation/index.rst b/documentation/index.rst index d01dc583..947612a1 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -7,12 +7,13 @@ Welcome to pyAggr3g470r's documentation! ======================================== -Deployment and configuration +Configuration and deployment ============================ .. toctree:: :maxdepth: 2 + requirements deployment Web services diff --git a/documentation/requirements.rst b/documentation/requirements.rst new file mode 100644 index 00000000..a3630144 --- /dev/null +++ b/documentation/requirements.rst @@ -0,0 +1,16 @@ +Requirements +============ + +The complete list of required Python modules is in the file +``requirements.txt``. + +The core technologies used are: + +* `Flask <http://flask.pocoo.org>`_ for the web backend; +* `asyncio <https://www.python.org/dev/peps/pep-3156/>`_ for the crawler; +* `SQLAlchemy <http://www.sqlalchemy.org>`_ for the data base. + +Python 3.4 is highly recommended, especially for the feed crawler. +The web server is working with Python 2.7 and Python 3. + +It is possible to connect your own crawler to the RESTful API. diff --git a/migrations/versions/1b750a389c22_remove_email_notification_column.py b/migrations/versions/1b750a389c22_remove_email_notification_column.py new file mode 100644 index 00000000..71529855 --- /dev/null +++ b/migrations/versions/1b750a389c22_remove_email_notification_column.py @@ -0,0 +1,25 @@ +"""remove email_notification column + +Revision ID: 1b750a389c22 +Revises: 48f561c0ce6 +Create Date: 2015-02-25 23:01:07.253429 + +""" + +# revision identifiers, used by Alembic. +revision = '1b750a389c22' +down_revision = '48f561c0ce6' + +import conf +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI: + op.drop_column('feed', 'email_notification') + + +def downgrade(): + op.add_column('feed', sa.Column('email_notification', sa.Boolean(), + default=False)) diff --git a/migrations/versions/4b5c161e1ced_.py b/migrations/versions/4b5c161e1ced_.py index 1fa91717..32cfe8c8 100644 --- a/migrations/versions/4b5c161e1ced_.py +++ b/migrations/versions/4b5c161e1ced_.py @@ -9,7 +9,7 @@ from datetime import datetime # revision identifiers, used by Alembic. revision = '4b5c161e1ced' -down_revision = '48f561c0ce6' +down_revision = '1b750a389c22' from alembic import op import sqlalchemy as sa diff --git a/pyaggr3g470r/export.py b/pyaggr3g470r/export.py index f60bb3a9..5f54a0c1 100644 --- a/pyaggr3g470r/export.py +++ b/pyaggr3g470r/export.py @@ -212,7 +212,6 @@ def export_json(user): "description": feed.description, "link": feed.link, "site_link": feed.site_link, - "email_notification": feed.email_notification, "enabled": feed.enabled, "created_date": feed.created_date.strftime('%s'), "articles": [ { diff --git a/pyaggr3g470r/forms.py b/pyaggr3g470r/forms.py index 3e987082..58abb864 100644 --- a/pyaggr3g470r/forms.py +++ b/pyaggr3g470r/forms.py @@ -83,7 +83,6 @@ class AddFeedForm(Form): title = TextField(lazy_gettext("Title"), [validators.Optional()]) link = TextField(lazy_gettext("Feed link"), [validators.Optional()]) site_link = TextField(lazy_gettext("Site link")) - email_notification = BooleanField(lazy_gettext("Email notification"), default=False) enabled = BooleanField(lazy_gettext("Check for updates"), default=True) submit = SubmitField(lazy_gettext("Save")) diff --git a/pyaggr3g470r/models/feed.py b/pyaggr3g470r/models/feed.py index 176f0f01..28cb2b92 100644 --- a/pyaggr3g470r/models/feed.py +++ b/pyaggr3g470r/models/feed.py @@ -42,7 +42,6 @@ class Feed(db.Model): description = db.Column(db.String(), default="FR") link = db.Column(db.String()) site_link = db.Column(db.String(), default="") - email_notification = db.Column(db.Boolean(), default=False) enabled = db.Column(db.Boolean(), default=True) created_date = db.Column(db.DateTime(), default=datetime.now) diff --git a/pyaggr3g470r/notifications.py b/pyaggr3g470r/notifications.py index e351573c..cf8fb723 100644 --- a/pyaggr3g470r/notifications.py +++ b/pyaggr3g470r/notifications.py @@ -20,7 +20,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import conf -from pyaggr3g470r import utils from pyaggr3g470r import emails @@ -60,13 +59,3 @@ def new_password_notification(user, password): (password, ) plaintext += "\n\nIt is advised to replace it as soon as connected to pyAggr3g470r.\n\nSee you," emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, subject="[pyAggr3g470r] New password", plaintext=plaintext) - -def new_article_notification(user, feed, article): - """ - New article notification. - """ - subject = '[pyAggr3g470r] ' + feed.title + ": " + article.title - html = """<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n%s\n</body>\n</html>""" % \ - (feed.title + ": " + article.title, article.content) - plaintext = utils.clear_string(html) - emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, subject=subject, plaintext=plaintext, html=html) diff --git a/pyaggr3g470r/templates/edit_feed.html b/pyaggr3g470r/templates/edit_feed.html index f1a61b89..1238e257 100644 --- a/pyaggr3g470r/templates/edit_feed.html +++ b/pyaggr3g470r/templates/edit_feed.html @@ -15,11 +15,6 @@ {{ form.site_link.label }} {{ form.site_link(class_="form-control", placeholder="Optional") }} {% for error in form.site_link.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} - {% if not_on_heroku %} - {{ form.email_notification.label }} - {{ form.email_notification(class_="checkbox") }} - {% endif %} - {{ form.enabled.label }} {{ form.enabled(class_="checkbox") }} diff --git a/pyaggr3g470r/utils.py b/pyaggr3g470r/utils.py index 01bcd36c..1fc84ff4 100755 --- a/pyaggr3g470r/utils.py +++ b/pyaggr3g470r/utils.py @@ -30,8 +30,7 @@ __license__ = "AGPLv3" # This file provides functions used for: # - the database management; # - generation of tags cloud; -# - HTML processing; -# - e-mail notifications. +# - HTML processing. # import re @@ -130,7 +129,7 @@ def import_opml(email, opml_content): new_feed = Feed(title=title, description=description, link=link, site_link=site_link, - email_notification=False, enabled=True) + enabled=True) user.feeds.append(new_feed) nb += 1 @@ -155,7 +154,7 @@ def import_json(email, json_content): continue new_feed = Feed(title=feed["title"], description="", link=feed["link"], \ - site_link=feed["site_link"], email_notification=feed["email_notification"], \ + site_link=feed["site_link"], \ created_date=datetime.datetime.fromtimestamp(int(feed["created_date"])), enabled=feed["enabled"]) user.feeds.append(new_feed) diff --git a/pyaggr3g470r/views/api/feed.py b/pyaggr3g470r/views/api/feed.py index 625ad52d..898e30b0 100644 --- a/pyaggr3g470r/views/api/feed.py +++ b/pyaggr3g470r/views/api/feed.py @@ -13,7 +13,6 @@ FEED_ATTRS = {'title': {'type': str}, 'description': {'type': str}, 'link': {'type': str}, 'site_link': {'type': str}, - 'email_notification': {'type': bool, 'default': False}, 'enabled': {'type': bool, 'default': True}, 'etag': {'type': str, 'default': ''}, 'last_modified': {'type': str}, diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index 0f8fc04d..d42d5db8 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -571,8 +571,7 @@ def edit_feed(feed_id=None): existing_feed = [f for f in g.user.feeds if feed.link == form.link.data] if len(existing_feed) == 0: new_feed = Feed(title=form.title.data, description="", link=form.link.data, \ - site_link=form.site_link.data, email_notification=form.email_notification.data, \ - enabled=form.enabled.data) + site_link=form.site_link.data, enabled=form.enabled.data) g.user.feeds.append(new_feed) #user.feeds = sorted(user.feeds, key=lambda t: t.title.lower()) db.session.commit() |