diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2012-05-24 09:45:38 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2012-05-24 09:45:38 -0400 |
commit | 5d9e8bae5c318e6cb25aec91c1dd6c63cda145bc (patch) | |
tree | 3baa0cae54438b21b6cb159781c2ac10a12f4529 /www/gps_report.cgi.in | |
parent | ac8144d10289d7075af757d0cc6547e1ab0991d4 (diff) | |
download | gpsd-5d9e8bae5c318e6cb25aec91c1dd6c63cda145bc.tar.gz |
Everything works except sample retention through the form cycle.
Diffstat (limited to 'www/gps_report.cgi.in')
-rw-r--r-- | www/gps_report.cgi.in | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/www/gps_report.cgi.in b/www/gps_report.cgi.in index 72089e36..78c3b097 100644 --- a/www/gps_report.cgi.in +++ b/www/gps_report.cgi.in @@ -24,7 +24,10 @@ form = cgi.FieldStorage() print "Content-type: text/html" print "" -def hasNeededElements(form): +def hasRequiredElements(form): + for fld in ("submitter", "vendor", "model", "techdoc", "sample"): + if not form.getvalue(fld): + return False return True formfields = ("submitter", @@ -46,7 +49,7 @@ formfields = ("submitter", "sample_notes", ) -if hasNeededElements(form) and form.getvalue("action") == "Send Report": +if hasRequiredElements(form) and form.getvalue("action") == "Send Report": print cgi.print_form(form) msg = "" report = MIMEMultipart() @@ -54,7 +57,7 @@ if hasNeededElements(form) and form.getvalue("action") == "Send Report": report['To'] = to_address report.preamble = "Part 1 is form data, part 2 is the sample" for field in formfields: - if field != "sample": + if field != "sample" and form.getvalue(field): msg += "%s: %s\n" % (field, form.getvalue(field)) report.attach(MIMEText(msg)) report.attach(MIMEText(form.getvalue("sample"))) @@ -480,7 +483,7 @@ print "</td></tr></table>"; print "<p>To refresh this summary, click <code>Review</code>\n"; # Must have all critical fields to ship -if hasNeededElements(form): +if hasRequiredElements(form): print ''' <p>Click the <code>Send Report</code> button to send your report to the GPSD developers. Eventually, your report is likely to appear on our <a |