From 9a1a50f7cb2f63071fe127a29fece79585ea4037 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 15 Mar 2015 17:20:38 +0100 Subject: pylint check --- pyaggr3g470r/controllers/abstract.py | 1 - pyaggr3g470r/controllers/feed.py | 6 +++--- pyaggr3g470r/notifications.py | 18 ++++++++++++------ pyaggr3g470r/views/api/common.py | 1 - pyaggr3g470r/views/views.py | 3 +-- 5 files changed, 16 insertions(+), 13 deletions(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/controllers/abstract.py b/pyaggr3g470r/controllers/abstract.py index a99e67f3..c084deb9 100644 --- a/pyaggr3g470r/controllers/abstract.py +++ b/pyaggr3g470r/controllers/abstract.py @@ -1,6 +1,5 @@ import logging from bootstrap import db -from sqlalchemy import update from werkzeug.exceptions import Forbidden, NotFound logger = logging.getLogger(__name__) diff --git a/pyaggr3g470r/controllers/feed.py b/pyaggr3g470r/controllers/feed.py index a3cdcddd..342ab88e 100644 --- a/pyaggr3g470r/controllers/feed.py +++ b/pyaggr3g470r/controllers/feed.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta +from datetime import datetime from .abstract import AbstractController from pyaggr3g470r.models import Feed @@ -17,7 +17,7 @@ class FeedController(AbstractController): feeds = [feed for feed in self.read(user_id=self.user_id, error_count__lt=max_error, enabled=True).limit(limit)] #last_retrieved__lt=max_last).limit(limit)] - """if feeds: + if feeds: self.update({'id__in': [feed.id for feed in feeds]}, - {'last_retrieved': now})""" + {'last_retrieved': now}) return feeds diff --git a/pyaggr3g470r/notifications.py b/pyaggr3g470r/notifications.py index cf8fb723..006aa594 100644 --- a/pyaggr3g470r/notifications.py +++ b/pyaggr3g470r/notifications.py @@ -30,10 +30,12 @@ def information_message(subject, plaintext): from pyaggr3g470r.models import User users = User.query.all() # Only send email for activated accounts. - emails = [user.email for user in users if user.activation_key == ""] + user_emails = [user.email for user in users if user.activation_key == ""] # Postmark has a limit of twenty recipients per message in total. - for i in xrange(0, len(emails), 19): - emails.send(to=conf.NOTIFICATION_EMAIL, bcc=", ".join(emails[i:i+19]), subject=subject, plaintext=plaintext) + for i in xrange(0, len(user_emails), 19): + emails.send(to=conf.NOTIFICATION_EMAIL, + bcc=", ".join(user_emails[i:i+19]), + subject=subject, plaintext=plaintext) def new_account_notification(user): """ @@ -41,7 +43,8 @@ def new_account_notification(user): """ plaintext = """Hello,\n\nYour account has been created. Click on the following link to confirm it:\n%s\n\nSee you,""" % \ (conf.PLATFORM_URL + 'confirm_account/' + user.activation_key) - emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, subject="[pyAggr3g470r] Account creation", plaintext=plaintext) + emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, + subject="[pyAggr3g470r] Account creation", plaintext=plaintext) def new_account_activation(user): """ @@ -49,7 +52,8 @@ def new_account_activation(user): """ plaintext = """Hello,\n\nYour account has been activated. You can now connect to the platform:\n%s\n\nSee you,""" % \ (conf.PLATFORM_URL) - emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, subject="[pyAggr3g470r] Account activated", plaintext=plaintext) + emails.send(to=user.email, bcc=conf.NOTIFICATION_EMAIL, + subject="[pyAggr3g470r] Account activated", plaintext=plaintext) def new_password_notification(user, password): """ @@ -58,4 +62,6 @@ def new_password_notification(user, password): plaintext = """Hello,\n\nA new password has been generated at your request:\n\n%s""" % \ (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) + emails.send(to=user.email, + bcc=conf.NOTIFICATION_EMAIL, + subject="[pyAggr3g470r] New password", plaintext=plaintext) diff --git a/pyaggr3g470r/views/api/common.py b/pyaggr3g470r/views/api/common.py index 856b4bb9..b1b0cd73 100644 --- a/pyaggr3g470r/views/api/common.py +++ b/pyaggr3g470r/views/api/common.py @@ -24,7 +24,6 @@ routes : import json import logging import dateutil.parser -from copy import deepcopy from functools import wraps from werkzeug.exceptions import Unauthorized, BadRequest from flask import request, g, session, Response diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index 9d368c42..88835068 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -27,14 +27,13 @@ __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "AGPLv3" import os -import json import string import random import hashlib import datetime from collections import namedtuple from bootstrap import application as app, db -from flask import render_template, request, flash, session, Response, \ +from flask import render_template, request, flash, session, \ url_for, redirect, g, current_app, make_response, jsonify from flask.ext.login import LoginManager, login_user, logout_user, \ login_required, current_user, AnonymousUserMixin -- cgit