Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
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
Xiaowu Zhang
wendelin
Commits
9bd40b48
Commit
9bd40b48
authored
Jun 15, 2022
by
Levin Zimmermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_wendelin: Cleanup
parent
8926f0e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
99 deletions
+10
-99
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataBucketStream.py
...eItem/portal_components/document.erp5.DataBucketStream.py
+10
-99
No files found.
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataBucketStream.py
View file @
9bd40b48
...
...
@@ -35,7 +35,8 @@ from Products.ERP5Type import Permissions, PropertySheet
from
erp5.component.module.BTreeData
import
PersistentString
from
erp5.component.module.Log
import
log
class
IndexSequence
:
class
IndexSequence
(
object
):
"""
A Sequence base class for data bucket stream following the
BTree.IReadSequence Interface
...
...
@@ -58,6 +59,7 @@ class IndexSequence:
sub_index_sequence
=
self
.
index_sequence
[
index1
:
index2
]
return
self
.
__class__
(
self
.
data_bucket_stream
,
sub_index_sequence
)
class
IndexKeySequence
(
IndexSequence
):
"""
A Sequence class to get a value sequence for data bucket stream
...
...
@@ -68,76 +70,8 @@ class IndexKeySequence(IndexSequence):
"""
bucket_index
,
bucket_key
=
self
.
index_sequence
[
index
]
return
(
bucket_index
,
bucket_key
)
class
IndexValueSequence
(
IndexSequence
):
"""
A Sequence class to get a value sequence for data bucket stream
"""
def
__getitem__
(
self
,
index
):
"""Return the value at the given index.
An IndexError is raised if the index cannot be found.
"""
bucket_key
=
self
.
index_sequence
[
index
]
return
self
.
data_bucket_stream
.
getBucketByKey
(
bucket_key
)
class
IndexItemSequence
(
IndexSequence
):
"""
A Sequence class to get a index item sequence for data bucket stream
"""
def
__getitem__
(
self
,
index
):
"""Return the value at the given index.
An IndexError is raised if the index cannot be found.
"""
bucket_index
,
bucket_key
=
self
.
index_sequence
[
index
]
return
(
bucket_index
,
self
.
data_bucket_stream
.
getBucketByKey
(
bucket_key
))
class
IndexKeyItemSequence
(
IndexSequence
):
"""
A Sequence class to get a index key item sequence for data bucket stream
"""
def
__getitem__
(
self
,
index
):
"""Return the value at the given index.
An IndexError is raised if the index cannot be found.
"""
bucket_index
,
bucket_key
=
self
.
index_sequence
[
index
]
return
(
bucket_index
,
bucket_key
,
self
.
data_bucket_stream
.
getBucketByKey
(
bucket_key
))
class
IndexSequence
:
"""
A Sequence base class for data bucket stream following the
BTree.IReadSequence Interface
"""
def
__init__
(
self
,
data_bucket_stream
,
index_sequence
):
self
.
data_bucket_stream
=
data_bucket_stream
self
.
index_sequence
=
index_sequence
def
__getitem__
(
self
,
index
):
"""Return the value at the given index.
An IndexError is raised if the index cannot be found.
"""
raise
NotImplementedError
def
__getslice__
(
self
,
index1
,
index2
):
"""Return a subsequence from the original sequence.
The subsequence includes the items from index1 up to, but not
including, index2.
"""
sub_index_sequence
=
self
.
index_sequence
[
index1
:
index2
]
return
self
.
__class__
(
self
.
data_bucket_stream
,
sub_index_sequence
)
class
IndexKeySequence
(
IndexSequence
):
"""
A Sequence class to get a value sequence for data bucket stream
"""
def
__getitem__
(
self
,
index
):
"""Return the value at the given index.
An IndexError is raised if the index cannot be found.
"""
bucket_index
,
bucket_key
=
self
.
index_sequence
[
index
]
return
(
bucket_index
,
bucket_key
)
class
IndexValueSequence
(
IndexSequence
):
"""
A Sequence class to get a value sequence for data bucket stream
...
...
@@ -148,7 +82,8 @@ class IndexValueSequence(IndexSequence):
"""
bucket_key
=
self
.
index_sequence
[
index
]
return
self
.
data_bucket_stream
.
getBucketByKey
(
bucket_key
)
class
IndexItemSequence
(
IndexSequence
):
"""
A Sequence class to get a index item sequence for data bucket stream
...
...
@@ -173,6 +108,7 @@ class IndexKeyItemSequence(IndexSequence):
return
(
bucket_index
,
bucket_key
,
self
.
data_bucket_stream
.
getBucketByKey
(
bucket_key
))
class
DataBucketStream
(
Document
):
"""
Represents data stored in many small files inside a "stream".
...
...
@@ -188,9 +124,10 @@ class DataBucketStream(Document):
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
CategoryCore
,
PropertySheet
.
SortIndex
)
property_sheets
=
(
PropertySheet
.
CategoryCore
,
PropertySheet
.
SortIndex
)
def
__init__
(
self
,
id
,
**
kw
):
self
.
initBucketTree
()
...
...
@@ -419,32 +356,6 @@ class DataBucketStream(Document):
sequence
=
sequence
[:
count
]
return
IndexKeyItemSequence
(
self
,
sequence
)
def
getBucketIndexItemSequenceByIndex
(
self
,
start_index
=
None
,
stop_index
=
None
,
count
=
None
,
exclude_start_index
=
False
,
exclude_stop_index
=
False
):
"""
Get a lazy sequence of bucket items
"""
sequence
=
self
.
_long_index_tree
.
items
(
min
=
start_index
,
max
=
stop_index
,
excludemin
=
exclude_start_index
,
excludemax
=
exclude_stop_index
)
if
count
is
not
None
:
sequence
=
sequence
[:
count
]
return
IndexItemSequence
(
self
,
sequence
)
def
getBucketIndexKeyItemSequenceByIndex
(
self
,
start_index
=
None
,
stop_index
=
None
,
count
=
None
,
exclude_start_index
=
False
,
exclude_stop_index
=
False
):
"""
Get a lazy sequence of bucket items
"""
sequence
=
self
.
_long_index_tree
.
items
(
min
=
start_index
,
max
=
stop_index
,
excludemin
=
exclude_start_index
,
excludemax
=
exclude_stop_index
)
if
count
is
not
None
:
sequence
=
sequence
[:
count
]
return
IndexKeyItemSequence
(
self
,
sequence
)
def
getItemList
(
self
):
"""
Return a list of all key, value pairs
...
...
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