2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

python: Fix plural forms of OVSDB types.

Fixes two problems.  First, the plural of chassis is also chassis.
Second, for linguistic analysis we need to consider plain words, not
words that have (e.g.) \fB and \fR pasted into them for nroff output.

This makes the OVN manpage for ovn-sb(5) talk about "set of Chassis"
not "set of Chassiss".

Acked-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ben Pfaff
2020-03-21 15:17:27 -07:00
parent 81ac8b3b19
commit 714a104995

View File

@@ -591,7 +591,16 @@ class Type(object):
if self.value:
return "map of %s%s-%s pairs" % (quantity, keyName, valueName)
else:
if keyName.endswith('s'):
# Extract the last word from 'keyName' so we can make it
# plural. For linguistic analysis, turn it into English
# without formatting so that we don't consider any prefix or
# suffix added by escapeLiteral.
plainKeyName = (self.key.toEnglish(returnUnchanged)
.rpartition(' ')[2].lower())
if plainKeyName == 'chassis':
plural = keyName
elif plainKeyName.endswith('s'):
plural = keyName + "es"
else:
plural = keyName + "s"