mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
Add a __str__ method to idl.Row
It's sometimes handy to log an entire Row object, so this just adds a string representation of the object as: Tablename(col1=val1, col2=val2, ..., coln=valn) Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -997,6 +997,12 @@ class Row(object):
|
|||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return int(self.__dict__['uuid'])
|
return int(self.__dict__['uuid'])
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "{table}({data})".format(
|
||||||
|
table=self._table.name,
|
||||||
|
data=", ".join("{col}={val}".format(col=c, val=getattr(self, c))
|
||||||
|
for c in sorted(self._table.columns)))
|
||||||
|
|
||||||
def __getattr__(self, column_name):
|
def __getattr__(self, column_name):
|
||||||
assert self._changes is not None
|
assert self._changes is not None
|
||||||
assert self._mutations is not None
|
assert self._mutations is not None
|
||||||
|
Reference in New Issue
Block a user