ovs.db.parser: Simplify code.
authorBen Pfaff <blp@nicira.com>
Tue, 23 Aug 2011 16:36:56 +0000 (09:36 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 24 Aug 2011 18:57:43 +0000 (11:57 -0700)
Suggested-by: Reid Price <reid@nicira.com>
python/ovs/db/parser.py

index 67b3bd53cf684c93f05daafa9cc634469ba59b4a..173922bab051add7e5e9275fa60ba2f7e0b0521a 100644 (file)
@@ -53,15 +53,13 @@ class Parser(object):
         if missing:
             name = missing.pop()
             if len(missing) > 1:
-                self.__raise_error("Member '%s' and %d other members "
-                                   "are present but not allowed here"
-                                   % (name, len(missing)))
+                present = "and %d other members are" % len(missing)
             elif missing:
-                self.__raise_error("Member '%s' and 1 other member "
-                                   "are present but not allowed here" % name)
+                present = "and 1 other member are"
             else:
-                self.__raise_error("Member '%s' is present but not "
-                                   "allowed here" % name)
+                present = "is"
+            self.__raise_error("Member '%s' %s present but not allowed here" %
+                               (name, present))
     
 def float_to_int(x):
     # XXX still needed?