[ovs-dev] [PATCH] python: Fix plural forms of OVSDB types.

Ben Pfaff blp at ovn.org
Sat Mar 21 22:17:27 UTC 2020


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".

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 python/ovs/db/types.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py
index b0eec6165b3b..a8ba01d4f2cc 100644
--- a/python/ovs/db/types.py
+++ b/python/ovs/db/types.py
@@ -591,9 +591,16 @@ class Type(object):
             if self.value:
                 return "map of %s%s-%s pairs" % (quantity, keyName, valueName)
             else:
-                if keyName.lower() == 'chassis':
-                    plural = ''
-                elif keyName.endswith('s'):
+                # Exract 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"
-- 
2.24.1



More information about the dev mailing list