Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
9f37c999
Commit
9f37c999
authored
Mar 29, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do some reformatting and un-optimization on undoLog()
parent
89308af4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
25 deletions
+23
-25
trunk/src/ZODB/FileStorage.py
trunk/src/ZODB/FileStorage.py
+23
-25
No files found.
trunk/src/ZODB/FileStorage.py
View file @
9f37c999
...
...
@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version
# record.
#
__version__
=
'$Revision: 1.8
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
6
$'
[
11
:
-
2
]
import
struct
,
time
,
os
,
string
,
base64
,
sys
from
struct
import
pack
,
unpack
...
...
@@ -1164,38 +1164,36 @@ class FileStorage(BaseStorage.BaseStorage,
def
undoLog
(
self
,
first
=
0
,
last
=-
20
,
filter
=
None
):
if
last
<
0
:
last
=
first
-
last
+
1
last
=
first
-
last
+
1
self
.
_lock_acquire
()
try
:
packt
=
self
.
_packt
if
packt
is
None
:
if
self
.
_packt
is
None
:
raise
UndoError
(
'Undo is currently disabled for database maintenance.<p>'
)
pos
=
self
.
_pos
pos
=
self
.
_pos
# BAW: Why 39 please? This makes no sense (see also below).
if
pos
<
39
:
return
[]
file
=
self
.
_file
seek
=
file
.
seek
read
=
file
.
read
unpack
=
struct
.
unpack
strip
=
string
.
strip
encode
=
base64
.
encodestring
r
=
[]
append
=
r
.
append
i
=
0
r
=
[]
i
=
0
while
i
<
last
and
pos
>
39
:
se
ek
(
pos
-
8
)
pos
=
pos
-
U64
(
read
(
8
))
-
8
seek
(
pos
)
h
=
read
(
TRANS_HDR_LEN
)
tid
,
tl
,
status
,
ul
,
dl
,
el
=
unpack
(
">8s8scHHH"
,
h
)
if
tid
<
packt
:
se
lf
.
_file
.
seek
(
pos
-
8
)
pos
=
pos
-
U64
(
self
.
_file
.
read
(
8
))
-
8
se
lf
.
_file
.
se
ek
(
pos
)
h
=
self
.
_file
.
read
(
TRANS_HDR_LEN
)
tid
,
tl
,
status
,
ul
,
dl
,
el
=
struct
.
unpack
(
">8s8scHHH"
,
h
)
if
tid
<
self
.
_
packt
:
break
if
status
!=
' '
:
continue
u
=
ul
and
read
(
ul
)
or
''
d
=
dl
and
read
(
dl
)
or
''
d
=
u
=
''
if
ul
:
u
=
self
.
_file
.
read
(
ul
)
if
dl
:
d
=
self
.
_file
.
read
(
dl
)
e
=
{}
if
el
:
try
:
...
...
@@ -1231,15 +1229,15 @@ class FileStorage(BaseStorage.BaseStorage,
id
=
tid
+
p64
(
pos
)
else
:
id
=
tid
+
p64
(
pos
)
+
next
d
=
{
'id'
:
encode
(
id
).
rstrip
(),
'time'
:
TimeStamp
(
tid
).
timeTime
(),
'user_name'
:
u
,
'description'
:
d
}
d
=
{
'id'
:
base64
.
encodestring
(
id
).
rstrip
(),
'time'
:
TimeStamp
(
tid
).
timeTime
(),
'user_name'
:
u
,
'description'
:
d
}
d
.
update
(
e
)
if
filter
is
None
or
filter
(
d
):
if
i
>=
first
:
append
(
d
)
i
=
i
+
1
r
.
append
(
d
)
i
+=
1
return
r
finally
:
self
.
_lock_release
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment