Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
43a399f3
Commit
43a399f3
authored
May 30, 2012
by
Romain Courteaud
Committed by
Sebastien Robin
Aug 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename file.
parent
b25c0dc8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
product/ERP5Type/BTreeData.py
product/ERP5Type/BTreeData.py
+15
-13
No files found.
product/ERP5Type/
pdata_replacement
.py
→
product/ERP5Type/
BTreeData
.py
View file @
43a399f3
import
transaction
from
cStringIO
import
StringIO
from
BTrees.IOBTree
import
IOBTree
from
BTrees.LOBTree
import
LOBTree
from
persistent
import
Persistent
class
PersistentString
(
persistent
.
Persistent
):
class
PersistentString
(
Persistent
):
def
__init__
(
self
,
value
):
self
.
value
=
value
def
__str__
(
self
):
return
self
.
value
class
BTreeData
2
(
persistent
.
Persistent
):
class
BTreeData
(
Persistent
):
def
__init__
(
self
):
self
.
tree
=
I
OBTree
()
self
.
tree
=
L
OBTree
()
def
write
(
self
,
buf
,
offset
):
# TODO: auto-aggregation of continuous keys when overwriting
offset
=
int
(
offset
)
assert
not
isinstance
(
offset
,
long
),
'Offset is too big for int '
\
'type: %s'
%
(
offset
,
)
# offset = long
(offset)
#
assert not isinstance(offset, long), 'Offset is too big for int ' \
#
'type: %s' % (offset, )
tree
=
self
.
tree
buf_len
=
len
(
buf
)
try
:
...
...
@@ -60,9 +61,10 @@ class BTreeData2(persistent.Persistent):
def
read
(
self
,
offset
,
size
):
#print 'read', hex(offset), hex(size)
start_offset
=
offset
=
int
(
offset
)
assert
not
isinstance
(
offset
,
long
),
'Offset is too big for int '
\
'type: %s'
%
(
offset
,
)
start_offset
=
offset
# start_offset = offset = int(offset)
# assert not isinstance(offset, long), 'Offset is too big for int ' \
# 'type: %s' % (offset, )
tree
=
self
.
tree
result
=
StringIO
()
write
=
result
.
write
...
...
@@ -96,9 +98,9 @@ class BTreeData2(persistent.Persistent):
return
result
.
getvalue
()
def
truncate
(
self
,
offset
):
offset
=
int
(
offset
)
assert
not
isinstance
(
offset
,
long
),
'Offset is too big for int '
\
'type: %s'
%
(
offset
,
)
#
offset = int(offset)
#
assert not isinstance(offset, long), 'Offset is too big for int ' \
#
'type: %s' % (offset, )
tree
=
self
.
tree
try
:
key
=
tree
.
maxKey
(
offset
)
...
...
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