aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-10-05 08:55:47 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-10-05 08:55:47 +0200
commit079cf9e25e6f6ee2ab4ad6a76e972c6b8da4982b (patch)
tree48f447e12df8827608c88637f9e53729112e90e2 /src
parentBugfix: 'feeds' is now a list. (diff)
downloadnewspipe-079cf9e25e6f6ee2ab4ad6a76e972c6b8da4982b.tar.gz
newspipe-079cf9e25e6f6ee2ab4ad6a76e972c6b8da4982b.tar.bz2
newspipe-079cf9e25e6f6ee2ab4ad6a76e972c6b8da4982b.zip
Removed refresh_rate column for the user table.
Diffstat (limited to 'src')
-rw-r--r--src/tests/controllers/feed.py4
-rw-r--r--src/web/controllers/feed.py6
-rw-r--r--src/web/forms.py6
-rw-r--r--src/web/models/user.py1
-rw-r--r--src/web/templates/admin/create_user.html3
-rw-r--r--src/web/templates/profile.html3
-rw-r--r--src/web/views/admin.py6
-rw-r--r--src/web/views/api/v2/feed.py6
-rw-r--r--src/web/views/user.py1
9 files changed, 6 insertions, 30 deletions
diff --git a/src/tests/controllers/feed.py b/src/tests/controllers/feed.py
index 6467a5a1..7dd77295 100644
--- a/src/tests/controllers/feed.py
+++ b/src/tests/controllers/feed.py
@@ -25,7 +25,3 @@ class FeedControllerTest(BasePyaggTest):
self.assertEquals(0, len(FeedController(3).list_fetchable()))
self.assertEquals(3, len(FeedController().list_fetchable()))
self.assertEquals(0, len(FeedController().list_fetchable()))
- self.assertEquals(3,
- len(FeedController(3).list_fetchable(refresh_rate=0)))
- self.assertEquals(5,
- len(FeedController().list_fetchable(refresh_rate=0)))
diff --git a/src/web/controllers/feed.py b/src/web/controllers/feed.py
index c67c6bea..6c41cce0 100644
--- a/src/web/controllers/feed.py
+++ b/src/web/controllers/feed.py
@@ -10,7 +10,6 @@ from web.lib.utils import clear_string
logger = logging.getLogger(__name__)
DEFAULT_LIMIT = 5
-DEFAULT_REFRESH_RATE = 60
DEFAULT_MAX_ERROR = conf.DEFAULT_MAX_ERROR
@@ -26,10 +25,9 @@ class FeedController(AbstractController):
.order_by('last_retrieved')
.limit(limit)]
- def list_fetchable(self, max_error=DEFAULT_MAX_ERROR,
- limit=DEFAULT_LIMIT, refresh_rate=DEFAULT_REFRESH_RATE):
+ def list_fetchable(self, max_error=DEFAULT_MAX_ERROR, limit=DEFAULT_LIMIT):
now = datetime.now()
- max_last = now - timedelta(minutes=refresh_rate)
+ max_last = now - timedelta(minutes=60)
feeds = self.list_late(max_last, max_error, limit)
if feeds:
self.update({'id__in': [feed.id for feed in feeds]},
diff --git a/src/web/forms.py b/src/web/forms.py
index 59a7bde5..f651c189 100644
--- a/src/web/forms.py
+++ b/src/web/forms.py
@@ -133,9 +133,6 @@ class UserForm(Form):
[validators.Length(min=6, max=35),
validators.Required(lazy_gettext("Please enter your email."))])
password = PasswordField(lazy_gettext("Password"))
- refresh_rate = IntegerField(lazy_gettext("Feeds refresh frequency "
- "(in minutes)"),
- default=60)
submit = SubmitField(lazy_gettext("Save"))
def validate(self):
@@ -160,9 +157,6 @@ class ProfileForm(Form):
password = PasswordField(lazy_gettext("Password"))
password_conf = PasswordField(lazy_gettext("Password Confirmation"))
webpage = URLField(lazy_gettext("Webpage"))
- refresh_rate = IntegerField(lazy_gettext("Feeds refresh frequency "
- "(in minutes)"),
- default=60)
is_public_profile = BooleanField(lazy_gettext("Public profile"),
default=True)
submit = SubmitField(lazy_gettext("Save"))
diff --git a/src/web/models/user.py b/src/web/models/user.py
index 1e7e3ec0..c8ed33f8 100644
--- a/src/web/models/user.py
+++ b/src/web/models/user.py
@@ -53,7 +53,6 @@ class User(db.Model, UserMixin, RightMixin):
date_created = db.Column(db.DateTime(), default=datetime.utcnow)
last_seen = db.Column(db.DateTime(), default=datetime.utcnow)
- refresh_rate = db.Column(db.Integer, default=60) # in minutes
# user rights
is_active = db.Column(db.Boolean(), default=False)
diff --git a/src/web/templates/admin/create_user.html b/src/web/templates/admin/create_user.html
index 64387dce..1d6d6c11 100644
--- a/src/web/templates/admin/create_user.html
+++ b/src/web/templates/admin/create_user.html
@@ -18,9 +18,6 @@
{{ form.password.label }}
{{ form.password(class_="form-control") }} {% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
- {{ form.refresh_rate.label }}
- {{ form.refresh_rate(class_="form-control") }} {% for error in form.refresh_rate.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
-
<br />
{{ form.submit(class_="btn btn-default") }}
</form>
diff --git a/src/web/templates/profile.html b/src/web/templates/profile.html
index 86ee51f6..e9dbd877 100644
--- a/src/web/templates/profile.html
+++ b/src/web/templates/profile.html
@@ -27,9 +27,6 @@
{{ form.password_conf.label }}
{{ form.password_conf(class_="form-control") }} {% for error in form.password_conf.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
- {{ form.refresh_rate.label }}
- {{ form.refresh_rate(class_="form-control") }} {% for error in form.refresh_rate.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
-
{{ form.is_public_profile.label }}
{{ form.is_public_profile(class_="form-control") }} {% for error in form.is_public_profile.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
<p>{{ _('Your profile will be available <a href="%(url)s">here</a>.', url=url_for('user.profile_public', nickname=user.nickname) ) }}</p>
diff --git a/src/web/views/admin.py b/src/web/views/admin.py
index 493a91c9..84e508a2 100644
--- a/src/web/views/admin.py
+++ b/src/web/views/admin.py
@@ -62,8 +62,7 @@ def process_user_form(user_id=None):
user_contr.update({'id': user_id},
{'nickname': form.nickname.data,
'email': form.email.data,
- 'password': form.password.data,
- 'refresh_rate': form.refresh_rate.data})
+ 'password': form.password.data})
user = user_contr.get(id=user_id)
flash(gettext('User %(nick)s successfully updated',
nick=user.nickname), 'success')
@@ -73,8 +72,7 @@ def process_user_form(user_id=None):
email=form.email.data,
pwdhash=generate_password_hash(form.password.data),
is_admin=False,
- is_active=True,
- refresh_rate=form.refresh_rate.data)
+ is_active=True)
flash(gettext('User %(nick)s successfully created',
nick=user.nickname), 'success')
return redirect(url_for('admin.user_form', user_id=user.id))
diff --git a/src/web/views/api/v2/feed.py b/src/web/views/api/v2/feed.py
index a5561475..a0691277 100644
--- a/src/web/views/api/v2/feed.py
+++ b/src/web/views/api/v2/feed.py
@@ -5,8 +5,7 @@ from flask_restful import Api
from web.views.common import api_permission
from web.controllers.feed import (FeedController,
DEFAULT_MAX_ERROR,
- DEFAULT_LIMIT,
- DEFAULT_REFRESH_RATE)
+ DEFAULT_LIMIT)
from web.views.api.v2.common import PyAggAbstractResource, \
PyAggResourceNew, \
@@ -29,8 +28,7 @@ class FeedsAPI(PyAggResourceMulti):
class FetchableFeedAPI(PyAggAbstractResource):
controller_cls = FeedController
attrs = {'max_error': {'type': int, 'default': DEFAULT_MAX_ERROR},
- 'limit': {'type': int, 'default': DEFAULT_LIMIT},
- 'refresh_rate': {'type': int, 'default': DEFAULT_REFRESH_RATE}}
+ 'limit': {'type': int, 'default': DEFAULT_LIMIT}}
@api_permission.require(http_exception=403)
def get(self):
diff --git a/src/web/views/user.py b/src/web/views/user.py
index 541432bb..b877f9c7 100644
--- a/src/web/views/user.py
+++ b/src/web/views/user.py
@@ -107,7 +107,6 @@ def profile():
{'nickname': form.nickname.data,
'email': form.email.data,
'password': form.password.data,
- 'refresh_rate': form.refresh_rate.data,
'is_public_profile': form.is_public_profile.data,
'webpage': form.webpage.data})
bgstack15