or (type_ == ovs.db.types.StringType and type(json) in [str, unicode])):
atom = Atom(type_, json)
elif type_ == ovs.db.types.UuidType:
- atom = Atom(type_, ovs.ovsuuid.UUID.from_json(json, symtab))
+ atom = Atom(type_, ovs.ovsuuid.from_json(json, symtab))
else:
raise error.Error("expected %s" % type_.to_string(), json)
atom.check_constraints(base)
def to_json(self):
if self.type == ovs.db.types.UuidType:
- return self.value.to_json()
+ return ovs.ovsuuid.to_json(self.value)
else:
return self.value
return ['%s.string = xstrdup("%s");'
% (var, escapeCString(self.value))]
elif self.type == ovs.db.types.UuidType:
- return self.value.cInitUUID(var)
+ return ovs.ovsuuid.to_c_assignment(self.value, var)
def toEnglish(self, escapeLiteral=returnUnchanged):
if self.type == ovs.db.types.IntegerType:
def __contains__(self, item):
return item in self.values
- def clone(self):
+ def copy(self):
return Datum(self.type, dict(self.values))
@staticmethod
This function is not commonly useful because the most ordinary way to
obtain a datum is ultimately via Datum.from_json() or Atom.from_json(),
which check constraints themselves."""
- for keyAtom, valueAtom in self.values:
- keyAtom.check_constraints()
+ for keyAtom, valueAtom in self.values.iteritems():
+ keyAtom.check_constraints(self.type.key)
if valueAtom is not None:
- valueAtom.check_constraints()
+ valueAtom.check_constraints(self.type.value)
@staticmethod
def from_json(type_, json, symtab=None):