From e8450851b66a914e3f93527d823069f5c4e7c0ac Mon Sep 17 00:00:00 2001 From: kingsj0405 Date: Fri, 2 Mar 2018 09:47:54 +0100 Subject: [PATCH 1/3] Stop submit if empty without required The main problem is textarea is hide when check required content. But codemirror don't have robust solution about that and give up. So I check empty content without required as wordaround. --- template/article_editor.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/template/article_editor.html b/template/article_editor.html index 17e41e0..20b850c 100644 --- a/template/article_editor.html +++ b/template/article_editor.html @@ -36,7 +36,7 @@ - + @@ -66,5 +66,10 @@ .val(editor.getValue()); } ) + $('form').submit(function(e) { + if(!$('textarea[name=content]').val()) { + e.preventDefault(e); + } + }); {% endblock %} From a86c9a0fcdef8c50d3272563738709497669d225 Mon Sep 17 00:00:00 2001 From: kingsj0405 Date: Fri, 2 Mar 2018 10:11:01 +0100 Subject: [PATCH 2/3] Fix indent Follow Code Review --- template/article_editor.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/template/article_editor.html b/template/article_editor.html index 20b850c..06a4c06 100644 --- a/template/article_editor.html +++ b/template/article_editor.html @@ -66,10 +66,10 @@ .val(editor.getValue()); } ) - $('form').submit(function(e) { - if(!$('textarea[name=content]').val()) { - e.preventDefault(e); - } - }); + $('form').submit(function(e) { + if(!$('textarea[name=content]').val()) { + e.preventDefault(e); + } + }); {% endblock %} From a185623f070813b8afbafc6517c5f4cd1d0c1f73 Mon Sep 17 00:00:00 2001 From: kingsj0405 Date: Fri, 2 Mar 2018 10:35:04 +0100 Subject: [PATCH 3/3] Apply autopep8 --- resource/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/chat.py b/resource/chat.py index a01c472..e8cb022 100644 --- a/resource/chat.py +++ b/resource/chat.py @@ -99,7 +99,7 @@ def render_POST(self, request): try: req.write("message coming") req.finish() - except: + except BaseException: pass self.request_pool = [] return "chat posted"