Skip to content

Commit

Permalink
Appease flake8.
Browse files Browse the repository at this point in the history
Signed-off-by: Kurt Garloff <kurt@garloff.de>
  • Loading branch information
garloff committed Nov 26, 2023
1 parent f579763 commit 697d50a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Tests/iaas/flavor-naming/flavor-form.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,31 @@
#
# (c) Kurt Garloff <kurt@garloff.de>, 11/2023
# SPDX-License-Identifier: CC-BY-SA-4.0
import os
"""
flavor-form.py
CGI script to get passed flavor from a html form (GET)
and parses it according to SCS flavor naming.
It returns an error (sometimes with a useful error message)
or a human-readable description of the flavor.
"""

# import os
import sys
import traceback
# import traceback
import cgi


def main(argv):
"Entry point for for cgi"
"Entry point for cgi flavor parsing"
import importlib
fnmd = importlib.import_module("flavor-name-describe")
print("Content-Type: text/html\n")
form = cgi.FieldStorage()
try:
fnm = form["flavor"].value
print(f"<h1>SCS flavor name {fnm}</h1>")
pnm = fnmd.main((fnm,))
except (TypeError,NameError,KeyError) as exc:
fnmd.main((fnm,))
except (TypeError, NameError, KeyError) as exc:
print("ERROR<br/>")
print(exc)
print('<br/><br/><FORM ACTION="/cgi-bin/flavor-form.py" METHOD="GET">')
Expand All @@ -29,5 +38,6 @@ def main(argv):
print('</FORM>')
print("\n<br/><br/><a href=\"/\">Back to main page</a>")


if __name__ == "__main__":
main(sys.argv[1:])

0 comments on commit 697d50a

Please sign in to comment.