From 7c1c7699e16153d8816edbced79be8481513f3f3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 1 Feb 2013 14:52:49 -0800 Subject: [PATCH] python/ovs/db/types: Fix English grammar for enums with one member. Before this change, enums that have one member were formatted as, e.g.: "one of xyzzy, , or " This changes them to be formatted as: "must be xyzzy" which makes much more sense. (An enum with one member may make some sense if you are trying to leave the possibility for future expansion.) Signed-off-by: Ben Pfaff --- python/ovs/db/types.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py index 5865acd7ad3..bd1c259cb5f 100644 --- a/python/ovs/db/types.py +++ b/python/ovs/db/types.py @@ -287,7 +287,9 @@ def constraintsToEnglish(self, escapeLiteral=returnUnchanged, if self.enum: literals = [value.toEnglish(escapeLiteral) for value in self.enum.values] - if len(literals) == 2: + if len(literals) == 1: + english = 'must be %s' % (literals[0]) + elif len(literals) == 2: english = 'either %s or %s' % (literals[0], literals[1]) else: english = 'one of %s, %s, or %s' % (literals[0],