From 6664042d911179c1a19a6a8fa8d0acd4a2ce5734 Mon Sep 17 00:00:00 2001 From: pluja Date: Thu, 27 Aug 2020 10:56:00 +0200 Subject: [PATCH] Add empty feed --- app/routes.py | 6 +++--- app/templates/twitter.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/routes.py b/app/routes.py index 30659c8..8fcf23a 100644 --- a/app/routes.py +++ b/app/routes.py @@ -440,7 +440,7 @@ def register(): if User.query.filter_by(username=form.username.data).first(): flash("This username is taken! Try with another.") return redirect(request.referrer) - + user = User(username=form.username.data) user.set_password(form.password.data) db.session.add(user) @@ -482,10 +482,10 @@ def twitterUserSearch(terms): html = html.body.find_all('div', attrs={'class':'timeline-item'}) for item in html: descriptionBody = item.find('div', attrs={'class':'tweet-content'}) - if not descriptionBody: + '''if not descriptionBody: description="" else: - description = "".join([str(x) for x in descriptionBody.contents]) + description = "".join([str(x) for x in descriptionBody.contents])''' user = { "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'), diff --git a/app/templates/twitter.html b/app/templates/twitter.html index 36a5c5a..6e85f75 100644 --- a/app/templates/twitter.html +++ b/app/templates/twitter.html @@ -17,6 +17,6 @@ {% include '_twitter_post.html' %} {% endfor %} {% else %} -
No posts
+ {% include '_empty_feed.html' %} {% endif %} {% endblock %}