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__':