diff options
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/export.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/forms.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/models.py | 1 | ||||
-rw-r--r-- | pyaggr3g470r/notifications.py | 11 | ||||
-rw-r--r-- | pyaggr3g470r/rest.py | 6 | ||||
-rw-r--r-- | pyaggr3g470r/templates/edit_feed.html | 5 | ||||
-rwxr-xr-x | pyaggr3g470r/utils.py | 7 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 3 |
8 files changed, 4 insertions, 31 deletions
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.py b/pyaggr3g470r/models.py index b7a75d5f..21e9ee34 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -105,7 +105,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) articles = db.relationship('Article', backref = 'source', lazy = 'dynamic', cascade='all,delete-orphan', diff --git a/pyaggr3g470r/notifications.py b/pyaggr3g470r/notifications.py index 8b6ff0c9..1acf782e 100644 --- a/pyaggr3g470r/notifications.py +++ b/pyaggr3g470r/notifications.py @@ -19,7 +19,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from pyaggr3g470r import utils from pyaggr3g470r import conf from pyaggr3g470r import emails @@ -59,13 +58,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)
\ No newline at end of file diff --git a/pyaggr3g470r/rest.py b/pyaggr3g470r/rest.py index 6f5dd9b9..1f354167 100644 --- a/pyaggr3g470r/rest.py +++ b/pyaggr3g470r/rest.py @@ -237,7 +237,6 @@ class FeedListAPI(Resource): self.reqparse.add_argument('description', type = unicode, default = "", location = 'json') self.reqparse.add_argument('link', type = unicode, location = 'json') self.reqparse.add_argument('site_link', type = unicode, default = "", location = 'json') - self.reqparse.add_argument('email_notification', type = bool, default = False, location = 'json') self.reqparse.add_argument('enabled', type = bool, default = True ,location = 'json') super(FeedListAPI, self).__init__() @@ -251,7 +250,6 @@ class FeedListAPI(Resource): "description": feed.description, "link": feed.link, "site_link": feed.site_link, - "email_notification": feed.email_notification, "enabled": feed.enabled, "created_date": feed.created_date } @@ -271,7 +269,6 @@ class FeedListAPI(Resource): return jsonify({'message': 'missing argument: %s' % (k,)}) new_feed = Feed(title=feed_dict["title"], description=feed_dict["description"], link=feed_dict["link"], site_link=feed_dict["site_link"], - email_notification=feed_dict["email_notification"], enabled=feed_dict["enabled"]) g.user.feeds.append(new_feed) try: @@ -292,7 +289,6 @@ class FeedAPI(Resource): self.reqparse.add_argument('description', type = unicode, location = 'json') self.reqparse.add_argument('link', type = unicode, location = 'json') self.reqparse.add_argument('site_link', type = unicode, location = 'json') - self.reqparse.add_argument('email_notification', type = bool, location = 'json') self.reqparse.add_argument('enabled', type = bool ,location = 'json') super(FeedAPI, self).__init__() @@ -332,8 +328,6 @@ class FeedAPI(Resource): feed.link = args['link'] if None is not args.get('site_link', None): feed.site_link = args['site_link'] - if None is not args.get('email_notification', None): - feed.email_notification = args['email_notification'] if None is not args.get('enabled', None): feed.enabled = args['enabled'] db.session.commit() 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 c6264106..972909af 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 @@ -129,7 +128,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 @@ -154,7 +153,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.py b/pyaggr3g470r/views.py index f0422c3c..e5e07cde 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -656,8 +656,7 @@ def edit_feed(feed_id=None): existing_feed = [feed for feed 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() |