From e0dffab6492d9f1e6b916ad0a9f8abfa63737741 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 24 May 2012 08:41:53 -0400 Subject: Remove a magic string in the CGI. --- www/gps_report.cgi.in | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'www/gps_report.cgi.in') diff --git a/www/gps_report.cgi.in b/www/gps_report.cgi.in index d0228201..8aa3a44e 100644 --- a/www/gps_report.cgi.in +++ b/www/gps_report.cgi.in @@ -25,17 +25,6 @@ print "" def hasNeededElements(form): return True -if hasNeededElements(form) and form.getvalue("action") == "Send Report": - msg = "This is only a test" - smtp = smtplib.SMTP(host="thyrsus.com") - #smtp.set_debuglevel(1) - smtp.sendmail(servaddr, ["esr@thyrsus.com"], msg) - smtp.quit() - print "

New device report accepted. Thanks for helping improve GPSD.\n"; - sys.exit(0) - -# Everything below here is page generation - defaults = {"submitter":"", "vendor": "", "model": "", @@ -55,6 +44,24 @@ defaults = {"submitter":"", "sample_notes": "", } +if hasNeededElements(form) and form.getvalue("action") == "Send Report": + print cgi.print_form(form) + msg = "" + for field in defaults: + msg += "%s: %s\n" % (field, form.getvalue(field)) + print "

"
+    print msg
+    print "
" + msg = "This is only a test" + smtp = smtplib.SMTP(host=servaddr.split("@")[1]) + #smtp.set_debuglevel(1) + smtp.sendmail(servaddr, ["esr@thyrsus.com"], msg) + smtp.quit() + print "

New device report accepted. Thanks for helping improve GPSD.\n"; + sys.exit(0) + +# Everything below here is page generation + for key in form.keys(): if key in form.keys(): defaults[key] = form.getvalue(key) -- cgit v1.2.1