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
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
Xavier Thompson
erp5
Commits
a10190ff
Commit
a10190ff
authored
May 31, 2012
by
Vincent Pelletier
Committed by
Sebastien Robin
Aug 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent using negative offsets.
parent
8cd57536
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
product/ERP5Type/BTreeData.py
product/ERP5Type/BTreeData.py
+8
-0
No files found.
product/ERP5Type/BTreeData.py
View file @
a10190ff
...
@@ -9,6 +9,8 @@ class PersistentString(Persistent):
...
@@ -9,6 +9,8 @@ class PersistentString(Persistent):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
value
return
self
.
value
negative_offset_error
=
ValueError
(
'Negative offset'
)
class
BTreeData
(
Persistent
):
class
BTreeData
(
Persistent
):
"""
"""
In-ZODB (non-BLOB) storage of arbitrary binary data.
In-ZODB (non-BLOB) storage of arbitrary binary data.
...
@@ -49,6 +51,8 @@ class BTreeData(Persistent):
...
@@ -49,6 +51,8 @@ class BTreeData(Persistent):
Offset of first data byte.
Offset of first data byte.
"""
"""
# TODO: auto-aggregation of continuous keys when overwriting
# TODO: auto-aggregation of continuous keys when overwriting
if
offset
<
0
:
raise
negative_offset_error
tree
=
self
.
_tree
tree
=
self
.
_tree
key
=
offset
key
=
offset
try
:
try
:
...
@@ -97,6 +101,8 @@ class BTreeData(Persistent):
...
@@ -97,6 +101,8 @@ class BTreeData(Persistent):
Returns string of read data.
Returns string of read data.
"""
"""
if
offset
<
0
:
raise
negative_offset_error
tree
=
self
.
_tree
tree
=
self
.
_tree
try
:
try
:
key
=
tree
.
maxKey
(
offset
)
key
=
tree
.
maxKey
(
offset
)
...
@@ -140,6 +146,8 @@ class BTreeData(Persistent):
...
@@ -140,6 +146,8 @@ class BTreeData(Persistent):
offset (int)
offset (int)
Offet of the first byte to discard.
Offet of the first byte to discard.
"""
"""
if
offset
<
0
:
raise
negative_offset_error
tree
=
self
.
_tree
tree
=
self
.
_tree
try
:
try
:
key
=
tree
.
maxKey
(
offset
)
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