Add empty feed

This commit is contained in:
pluja 2020-08-27 10:56:00 +02:00
parent 5003bcc8b5
commit 6664042d91
2 changed files with 4 additions and 4 deletions

View File

@ -440,7 +440,7 @@ def register():
if User.query.filter_by(username=form.username.data).first(): if User.query.filter_by(username=form.username.data).first():
flash("This username is taken! Try with another.") flash("This username is taken! Try with another.")
return redirect(request.referrer) return redirect(request.referrer)
user = User(username=form.username.data) user = User(username=form.username.data)
user.set_password(form.password.data) user.set_password(form.password.data)
db.session.add(user) db.session.add(user)
@ -482,10 +482,10 @@ def twitterUserSearch(terms):
html = html.body.find_all('div', attrs={'class':'timeline-item'}) html = html.body.find_all('div', attrs={'class':'timeline-item'})
for item in html: for item in html:
descriptionBody = item.find('div', attrs={'class':'tweet-content'}) descriptionBody = item.find('div', attrs={'class':'tweet-content'})
if not descriptionBody: '''if not descriptionBody:
description="" description=""
else: else:
description = "".join([str(x) for x in descriptionBody.contents]) description = "".join([str(x) for x in descriptionBody.contents])'''
user = { user = {
"fullName": item.find('a', attrs={'class':'fullname'}).getText().encode('latin_1').decode('unicode_escape').encode('latin_1').decode('utf8'), "fullName": item.find('a', attrs={'class':'fullname'}).getText().encode('latin_1').decode('unicode_escape').encode('latin_1').decode('utf8'),
"username": item.find('a', attrs={'class':'username'}).getText().encode('latin_1').decode('unicode_escape').encode('latin_1').decode('utf8'), "username": item.find('a', attrs={'class':'username'}).getText().encode('latin_1').decode('unicode_escape').encode('latin_1').decode('utf8'),

View File

@ -17,6 +17,6 @@
{% include '_twitter_post.html' %} {% include '_twitter_post.html' %}
{% endfor %} {% endfor %}
{% else %} {% else %}
<div>No posts</div> {% include '_empty_feed.html' %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}