[ovs-dev] python: Fix plural forms of OVSDB types.
diff mbox series

Message ID 20200321221727.3975073-1-blp@ovn.org
State New
Headers show
Series
  • [ovs-dev] python: Fix plural forms of OVSDB types.
Related show

Commit Message

Ben Pfaff March 21, 2020, 10:17 p.m. UTC
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@ovn.org>
---
 python/ovs/db/types.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

0-day Robot March 21, 2020, 10:56 p.m. UTC | #1
Bleep bloop.  Greetings Ben Pfaff, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
error: sha1 information is lacking or useless (python/ovs/db/types.py).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 python: Fix plural forms of OVSDB types.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot

Patch
diff mbox series

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"