From 436c54f8e35a1b38f52fc658f9ae7e3e9caa2b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilberto=20Gon=C3=A7alves?= Date: Mon, 18 Nov 2013 23:14:38 +0000 Subject: [PATCH] Fixed issue where if type=='html' and no content the app would bork --- service.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/service.py b/service.py index a3d8d67..f752992 100644 --- a/service.py +++ b/service.py @@ -20,22 +20,22 @@ def fuck_gpl3(): content = get_readable_content_from_url(url) print url - if type == 'html': - print url - markdown_url_contents = _markdown_to_html(content) - return render_template( - 'index.html', - converted_url_contents=markdown_url_contents, - page_url=url, - ) - else: - if url: - if content: - return content, 200, {'Content-Type': 'text/x-markdown; charset=UTF-8'} - else: - return '404 Not Found', 404 + if url: + if not content: + return '404 Not Found', 404 + + if type == 'html': + print url + markdown_url_contents = _markdown_to_html(content) + return render_template( + 'index.html', + converted_url_contents=markdown_url_contents, + page_url=url, + ) else: - return render_template('index.html') + return content, 200, {'Content-Type': 'text/x-markdown; charset=UTF-8'} + else: + return render_template('index.html') if __name__ == '__main__':