From: Oleg Broytman Date: Tue, 20 May 2014 02:44:39 +0000 (+0400) Subject: Report error if required parameter 'q' is missing X-Git-Tag: v0.1~24 X-Git-Url: https://git.phdru.name/?p=phdru.name%2Fcgi-bin%2Fblog-ru%2Fsearch-tags.git;a=commitdiff_plain;h=457d8766cac234bb006d4c2aff05e4519f2e58ac Report error if required parameter 'q' is missing --- diff --git a/search-tags.py b/search-tags.py index 6675a89..cbac10c 100755 --- a/search-tags.py +++ b/search-tags.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -"""Search tags""" +"""Search tags CGI""" __author__ = "Oleg Broytman " __copyright__ = "Copyright (C) 2014 PhiloSoft Design" @@ -7,7 +7,12 @@ __license__ = "GNU GPL" import cgi from parse_query import parser +from html.response import response form = cgi.FieldStorage() if not form.has_key('q'): - print "Error" + status = "400 Bad request" + title = "Error!" + body = "Required parameter is missing!" + +response(title, body, status)