[Zope3-checkins] CVS: Zope3/src/zodb/storage - file.py:1.23
Barry Warsaw
barry@wooz.org
Wed, 9 Apr 2003 14:00:44 -0400
Update of /cvs-repository/Zope3/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv13901
Modified Files:
file.py
Log Message:
_begin(), _finish(): Fix signatures since user, description, ext is
never passed here. Get the information from self._ude where needed.
FileIterator.__iter__(), _readnext(): Decode the stored utf-8 string
back into its Unicode original.
=== Zope3/src/zodb/storage/file.py 1.22 => 1.23 ===
--- Zope3/src/zodb/storage/file.py:1.22 Thu Apr 3 16:49:30 2003
+++ Zope3/src/zodb/storage/file.py Wed Apr 9 14:00:43 2003
@@ -1031,8 +1031,9 @@
if self._tfile is not None:
self._tfile.seek(0)
- def _begin(self, tid, u, d, e):
+ def _begin(self, tid):
self._nextpos = 0
+ u, d, e = self._ude
self._thl = TRANS_HDR_LEN + len(u) + len(d) + len(e)
if self._thl > 65535:
# one of u, d, or e may be > 65535
@@ -1056,10 +1057,8 @@
return # No data in this trans
self._tfile.seek(0)
user, desc, ext = self._ude
-
self._file.seek(self._pos)
tl = self._thl + dlen
-
try:
# Note that we use a status of 'c', for checkpoint.
# If this flag isn't cleared, anything after this is
@@ -1087,11 +1086,11 @@
finally:
self._lock_release()
- def _finish(self, tid, u, d, e):
+ def _finish(self, tid):
nextpos = self._nextpos
if nextpos:
# Clear the checkpoint flag
- self._file.seek(self._pos +16 )
+ self._file.seek(self._pos + 16)
self._file.write(self._tstatus)
self._file.flush()
@@ -1969,8 +1968,9 @@
continue
pos = tpos+(TRANS_HDR_LEN+ul+dl+el)
- user = read(ul)
- description = read(dl)
+ # user and description are utf-8 encoded strings
+ user = read(ul).decode('utf-8')
+ description = read(dl).decode('utf-8')
e = {}
if el:
try:
@@ -2095,10 +2095,11 @@
if status != ' ':
return None
d = u = ''
+ # user and description are utf-8 encoded strings
if ul:
- u = self.file.read(ul)
+ u = self.file.read(ul).decode('utf-8')
if dl:
- d = self.file.read(dl)
+ d = self.file.read(dl).decode('utf-8')
e = {}
if el:
try: