update to work with newer versions of Flask-Login

This commit is contained in:
Kyle Mahan 2016-01-30 14:08:54 -08:00
parent d915b98175
commit a37c49aa13
5 changed files with 11 additions and 8 deletions

View file

@ -19,12 +19,15 @@ class User(db.Model):
settings = db.Column(JSON)
# Flask-Login integration
@property
def is_authenticated(self):
return True
@property
def is_active(self):
return True
@property
def is_anonymous(self):
return False
@ -101,7 +104,7 @@ class Subscription(db.Model):
tags = db.Column(db.String(256))
# exclude from the front page
exclude = db.Column(db.Boolean, default=False)
user = db.relationship(User, backref='subscriptions')
feed = db.relationship(Feed, backref='subscriptions')

View file

@ -20,7 +20,7 @@
</head>
<body>
<header>
{% if current_user.is_authenticated() %}
{% if current_user.is_authenticated %}
<div style="overflow: auto;">
<span class="h-x-app" style="font-weight: bold">
<img class="u-logo" src="{{ url_for('static', filename='logo.png') }}" style="max-height: 1.5em; vertical-align: middle;" />
@ -54,7 +54,7 @@
<div class="flash">{{ message }}</div>
{% endfor %}
{% if not current_user.is_authenticated() %}
{% if not current_user.is_authenticated %}
<form action="{{ url_for('.login') }}" method="POST">
<input type="url" name="me" placeholder="https://yourdomain.com" />
<input type="hidden" name="next" placeholder="{{ request.path }}" />

View file

@ -15,7 +15,7 @@
{% endblock head %}
{% block header %}
{% if current_user.is_authenticated() %}
{% if current_user.is_authenticated %}
<form action="{{ url_for('.subscribe') }}" method="POST">
<input type="url" id="origin" name="origin" placeholder="Subscribe to URL" />
</form>

View file

@ -5,7 +5,7 @@
{% endblock head %}
{% block header %}
{% if current_user.is_authenticated() %}
{% if current_user.is_authenticated %}
<form action="{{ url_for('.subscribe') }}" method="POST">
<input type="url" id="origin" name="origin" placeholder="Subscribe to URL" />
</form>
@ -40,7 +40,7 @@
<input type="text" name="feed" value="{{ s.feed.feed }}" readonly />
<label style="display: block; font-weight: normal;">
<input type="checkbox" name="exclude" value="true" {% if s.exclude %}checked{% endif %} />
<input type="checkbox" name="exclude" value="true" {% if s.exclude %}checked{% endif %} />
Exclude from primary feed
</label>

View file

@ -34,7 +34,7 @@ def index():
solo = False
all_tags = set()
if flask_login.current_user.is_authenticated():
if flask_login.current_user.is_authenticated:
for subsc in flask_login.current_user.subscriptions:
if subsc.tags:
all_tags.update(subsc.tags.split())
@ -322,7 +322,7 @@ def update_micropub_syndicate_to():
resp, resp.text)
return
flask.current_app.logger.debug('response from micropub endpoint: {}, {}',
flask.current_app.logger.debug('syndicate-to response: {}, {}',
resp, resp.text)
content_type = resp.headers['content-type']