From d12282c860f9285b90f5cca925b9d0b6908272f2 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Sun, 26 Jul 2015 09:12:46 +0200 Subject: [PATCH] String formatting positional argument fix. --- src/formdefinition.py | 4 ++-- src/formrender.py | 2 +- src/scriptform.py | 2 +- src/webserver.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/formdefinition.py b/src/formdefinition.py index 377f95a..2e0ebf3 100644 --- a/src/formdefinition.py +++ b/src/formdefinition.py @@ -42,8 +42,8 @@ class FormDefinition(object): for field in fields: for prop_name in required: if not prop_name in field: - raise KeyError("Missing required property '{}' for field " - "'{}'".format(prop_name, str(field))) + raise KeyError("Missing required property '{0}' for field " + "'{1}'".format(prop_name, str(field))) def get_field_def(self, field_name): """ diff --git a/src/formrender.py b/src/formrender.py index 109cffa..b3f9fd6 100644 --- a/src/formrender.py +++ b/src/formrender.py @@ -24,7 +24,7 @@ HTML_FIELD_CHECKBOX = u''' ''' -HTML_REQUIRED = u'{} •' diff --git a/src/scriptform.py b/src/scriptform.py index 8c5f01d..48a1e8c 100755 --- a/src/scriptform.py +++ b/src/scriptform.py @@ -237,7 +237,7 @@ def main(): # pragma: no cover sys.exit(0) except socket.error as err: log.exception(err) - sys.stderr.write("Cannot bind to port {}: {}\n".format( + sys.stderr.write("Cannot bind to port {0}: {1}\n".format( options.port, str(err) )) diff --git a/src/webserver.py b/src/webserver.py index cecf771..d0d0dc2 100644 --- a/src/webserver.py +++ b/src/webserver.py @@ -104,8 +104,8 @@ class RequestHandler(BaseHTTPRequestHandler): for header_k, header_v in err.headers.items(): self.send_header(header_k, header_v) self.end_headers() - self.wfile.write("Error {}: {}".format(err.status_code, - err.msg)) + self.wfile.write("Error {0}: {1}".format(err.status_code, + err.msg)) self.wfile.flush() return False except Exception as err: