Merge branch 'master' of ssh://github.com/openvswitch/ovs into master_new
[cascardo/ovs.git] / python / ovs / db / schema.py
index 12b997d..263907e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, 2011 Nicira Networks
+# Copyright (c) 2009, 2010, 2011 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ import sys
 
 from ovs.db import error
 import ovs.db.parser
-from ovs.db import types
+import ovs.db.types
 
 
 def _check_id(name, json):
@@ -101,7 +101,8 @@ class DbSchema(object):
         return DbSchema.from_json(self.to_json())
 
     def __follow_ref_table(self, column, base, base_name):
-        if not base or base.type != types.UuidType or not base.ref_table_name:
+        if (not base or base.type != ovs.db.types.UuidType
+                or not base.ref_table_name):
             return
 
         base.ref_table = self.tables.get(base.ref_table_name)
@@ -181,7 +182,7 @@ class TableSchema(object):
         indexes_json = parser.get_optional("indexes", [list], [])
         parser.finish()
 
-        if max_rows == None:
+        if max_rows is None:
             max_rows = sys.maxint
         elif max_rows <= 0:
             raise error.Error("maxRows must be at least 1", json)
@@ -217,7 +218,7 @@ class TableSchema(object):
         differ from 'default_is_root'.  Ordinarily 'default_is_root' should be
         false, because ordinarily a table would be not be part of the root set
         if its "isRoot" member is omitted.  However, garbage collection was not
-        orginally included in OVSDB, so in older schemas that do not include
+        originally included in OVSDB, so in older schemas that do not include
         any "isRoot" members, every table is implicitly part of the root set.
         To serialize such a schema in a way that can be read by older OVSDB
         tools, specify 'default_is_root' as True.
@@ -257,7 +258,8 @@ class ColumnSchema(object):
         parser = ovs.db.parser.Parser(json, "schema for column %s" % name)
         mutable = parser.get_optional("mutable", [bool], True)
         ephemeral = parser.get_optional("ephemeral", [bool], False)
-        type_ = types.Type.from_json(parser.get("type", [dict, str, unicode]))
+        type_ = ovs.db.types.Type.from_json(parser.get("type",
+                                                       [dict, str, unicode]))
         parser.finish()
 
         return ColumnSchema(name, mutable, not ephemeral, type_)