Commit b1552049 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bac7f527
......@@ -26,10 +26,12 @@ from six.moves.urllib_parse import urlsplit, urlunsplit
from zlib import crc32, adler32
from ZODB.TimeStamp import TimeStamp
import dateparser
from golang import b
def ashex(s):
# type: (bytes) -> bytes
return codecs.encode(s, 'hex')
#return codecs.encode(s, 'hex')
return b(codecs.encode(s, 'hex')) # XXX ok?
def fromhex(s):
# type: (Union[str,bytes]) -> bytes
......
......@@ -492,9 +492,10 @@ class ObjectCopy(Object):
# ObjectData represents record with object data.
class ObjectData(Object):
# .data HashOnly | bytes
# .hashfunc bytes hash function used for integrity
# .hashfunc bytes XXX hash function used for integrity
# .hash_ bytes hash of the object's data
def __init__(self, oid, data, hashfunc, hash_):
#assert isinstance(hashfunc, bytes)
super(ObjectData, self).__init__(oid)
self.data = data
self.hashfunc = hashfunc
......@@ -507,7 +508,7 @@ class ObjectData(Object):
size = data.size
else:
size = len(data)
z = b'obj %s %d %s:%s' % (ashex(self.oid), size, self.hashfunc, ashex(self.hash_))
z = b'obj %s %d %s:%s' % (ashex(self.oid), size, b(self.hashfunc), ashex(self.hash_))
if hashonly:
z += b' -'
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment