From 457d8766cac234bb006d4c2aff05e4519f2e58ac Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 20 May 2014 06:44:39 +0400 Subject: [PATCH] Report error if required parameter 'q' is missing --- search-tags.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) -- 2.39.2