#python

files_dir = consts.FILES_DIR
SCRIPT = consts.CGI_NAME

lib.prn("FILES_DIR", files_dir)
FILE = files_dir + os.sep + "gq.response"

id = params
lib.prn("id to remove", id)

file_dict = lib.get_dict(FILE,"id")
dates = file_dict.keys()
dates.sort()
dates.reverse()
author, title = file_dict[id]["author"], file_dict[id]["title"]
del file_dict[id]
lib.write_data(file_dict, FILE)

write('''<p> The comment "%s" posted by %s has been successfully
removed. <br/> You should now be redirected to the
<a href="%s?page=sites/ming-cgi/server/open/response/result">Comments page</a>.</p>''' \
% (title, author, SCRIPT))
write('<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=%s?page=sites/ming-cgi/server/open/response/result">' % SCRIPT)

