Fix Versionstamp encoding issue for Value objects

Python's struct.pack does not accept Value objects.
This commit is contained in:
Chris Donati 2019-03-30 14:58:01 -07:00
parent ce37a0cf7f
commit 156962e5bf
1 changed files with 4 additions and 1 deletions

View File

@ -180,8 +180,11 @@ class Versionstamp(object):
return "Versionstamp(" + repr(self.tr_version) + ", " + str(self.user_version) + ")"
def to_bytes(self):
tr_version = self.tr_version
if isinstance(tr_version, fdb.impl.Value):
tr_version = tr_version.value
return struct.pack(self._STRUCT_FORMAT_STRING,
self.tr_version if self.is_complete() else self._UNSET_TR_VERSION,
tr_version if self.is_complete() else self._UNSET_TR_VERSION,
self.user_version)
def completed(self, new_tr_version):