Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
klaus_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
Eteri
klaus_wendelin
Commits
8bd428c4
Commit
8bd428c4
authored
Jul 23, 2017
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lazy msgpack unpacking to Ingestion Policy Tool
parent
5acc25a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicyTool.py
...em/portal_components/document.erp5.IngestionPolicyTool.py
+22
-1
No files found.
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicyTool.py
View file @
8bd428c4
...
@@ -31,6 +31,19 @@ from Products.ERP5Type.Core.Folder import Folder
...
@@ -31,6 +31,19 @@ from Products.ERP5Type.Core.Folder import Folder
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
import
msgpack
import
msgpack
class
RestrictedUnpacker
:
"""
A lazy Unpacker which works in zopes restricted environment
"""
def
__init__
(
self
,
unpacker
):
self
.
unpacker
=
unpacker
def
__iter__
(
self
):
return
self
def
next
(
self
):
return
self
.
unpacker
.
next
()
class
IngestionPolicyTool
(
Folder
):
class
IngestionPolicyTool
(
Folder
):
"""
"""
A tool to manage so called policies for ingest data into ERP5.
A tool to manage so called policies for ingest data into ERP5.
...
@@ -63,3 +76,11 @@ class IngestionPolicyTool(Folder):
...
@@ -63,3 +76,11 @@ class IngestionPolicyTool(Folder):
# we need pure primitive list so we avoid zope security in restricted
# we need pure primitive list so we avoid zope security in restricted
# script environment, but we loose lazyness
# script environment, but we loose lazyness
return
[
x
for
x
in
msgpack_list
]
return
[
x
for
x
in
msgpack_list
]
def
unpack_lazy
(
self
,
data
,
use_list
=
True
):
"""
Lazy unpack data, usable in restructed environment
Setting use_list=False uses tuples instead of lists which is faster
"""
data_file
=
StringIO
(
data
)
return
RestrictedUnpacker
(
msgpack
.
Unpacker
(
data_file
,
use_list
=
use_list
))
\ No newline at end of file
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