Skip to content

Commit

Permalink
python/ovs/db/types: Fix English grammar for enums with one member.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
blp committed Feb 4, 2013
1 parent 8748ec7 commit 7c1c769
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/ovs/db/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 7c1c769

Please sign in to comment.