kylewm / redwind

Flask-based personal website #IndieWeb #OwnYourData
Other
45 stars 5 forks source link

Error when POSSEing Share to Twitter #78

Closed LanaCoyote closed 9 years ago

LanaCoyote commented 9 years ago

Attempting to share this page causes an error on my Redwind instance. This might be related to something I'm doing but it's worth looking into anyway.

Here's my log:

[Wed Sep 30 15:36:44.005258 2015] [wsgi:error] [pid 10901:tid 139663761188608] 2015-09-30 15:36:43,974 - redwind - ERROR - Exception on /share_on_twitter [GET]
[Wed Sep 30 15:36:44.005289 2015] [wsgi:error] [pid 10901:tid 139663761188608] Traceback (most recent call last):
[Wed Sep 30 15:36:44.005296 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask/app.py", line 1817, in wsgi_app
[Wed Sep 30 15:36:44.005302 2015] [wsgi:error] [pid 10901:tid 139663761188608]     response = self.full_dispatch_request()
[Wed Sep 30 15:36:44.005307 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask/app.py", line 1477, in full_dispatch_request
[Wed Sep 30 15:36:44.005313 2015] [wsgi:error] [pid 10901:tid 139663761188608]     rv = self.handle_user_exception(e)
[Wed Sep 30 15:36:44.005318 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask/app.py", line 1381, in handle_user_exception
[Wed Sep 30 15:36:44.005324 2015] [wsgi:error] [pid 10901:tid 139663761188608]     reraise(exc_type, exc_value, tb)
[Wed Sep 30 15:36:44.005329 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask/_compat.py", line 33, in reraise
[Wed Sep 30 15:36:44.005334 2015] [wsgi:error] [pid 10901:tid 139663761188608]     raise value
[Wed Sep 30 15:36:44.005339 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask/app.py", line 1475, in full_dispatch_request
[Wed Sep 30 15:36:44.005345 2015] [wsgi:error] [pid 10901:tid 139663761188608]     rv = self.dispatch_request()
[Wed Sep 30 15:36:44.005350 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask/app.py", line 1461, in dispatch_request
[Wed Sep 30 15:36:44.005355 2015] [wsgi:error] [pid 10901:tid 139663761188608]     return self.view_functions[rule.endpoint](**req.view_args)
[Wed Sep 30 15:36:44.005360 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/flask_login.py", line 758, in decorated_view
[Wed Sep 30 15:36:44.005365 2015] [wsgi:error] [pid 10901:tid 139663761188608]     return func(*args, **kwargs)
[Wed Sep 30 15:36:44.005370 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/webapps/redwind/htdocs/redwind/plugins/twitter.py", line 196, in share_on_twitter
[Wed Sep 30 15:36:44.005375 2015] [wsgi:error] [pid 10901:tid 139663761188608]     preview, _ = guess_raw_share_tweet_content(post)
[Wed Sep 30 15:36:44.005381 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/webapps/redwind/htdocs/redwind/plugins/twitter.py", line 477, in guess_raw_share_tweet_content
[Wed Sep 30 15:36:44.005386 2015] [wsgi:error] [pid 10901:tid 139663761188608]     imgs = list(collect_images(context))
[Wed Sep 30 15:36:44.005391 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/webapps/redwind/htdocs/redwind/plugins/twitter.py", line 116, in collect_images
[Wed Sep 30 15:36:44.005396 2015] [wsgi:error] [pid 10901:tid 139663761188608]     soup = BeautifulSoup(html)
[Wed Sep 30 15:36:44.005408 2015] [wsgi:error] [pid 10901:tid 139663761188608]   File "/home/lancey/lib/python3.4/bs4/__init__.py", line 162, in __init__
[Wed Sep 30 15:36:44.005413 2015] [wsgi:error] [pid 10901:tid 139663761188608]     elif len(markup) <= 256:
[Wed Sep 30 15:36:44.005420 2015] [wsgi:error] [pid 10901:tid 139663761188608] TypeError: object of type 'NoneType' has no len()
[Wed Sep 30 15:36:44.005432 2015] [wsgi:error] [pid 10901:tid 139663761188608]

This should be a simple one line fix.