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
Alexander Emmerich
erp5
Commits
2a5f5ed5
Commit
2a5f5ed5
authored
Oct 30, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IntrospectionTool: fix
parent
ae7db4ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
11 deletions
+27
-11
product/ERP5/Tool/IntrospectionTool.py
product/ERP5/Tool/IntrospectionTool.py
+5
-11
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+22
-0
No files found.
product/ERP5/Tool/IntrospectionTool.py
View file @
2a5f5ed5
...
@@ -39,7 +39,8 @@ from Products.ERP5Type import Permissions
...
@@ -39,7 +39,8 @@ from Products.ERP5Type import Permissions
from
AccessControl.SecurityManagement
import
setSecurityManager
from
AccessControl.SecurityManagement
import
setSecurityManager
from
Products.ERP5
import
_dtmldir
from
Products.ERP5
import
_dtmldir
from
Products.ERP5.Tool.LogMixin
import
LogMixin
from
Products.ERP5.Tool.LogMixin
import
LogMixin
from
Products.ERP5Type.Utils
import
_setSuperSecurityManager
from
Products.ERP5Type.Utils
import
\
_setSuperSecurityManager
,
FileAsStreamIterator
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
from
AccessControl
import
Unauthorized
from
AccessControl
import
Unauthorized
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
...
@@ -155,16 +156,9 @@ class IntrospectionTool(LogMixin, BaseTool):
...
@@ -155,16 +156,9 @@ class IntrospectionTool(LogMixin, BaseTool):
tmp_file_path
=
file_path
tmp_file_path
=
file_path
r
=
FileAsStreamIterator
(
tmp_file_path
,
remove_file
=
compressed
)
with
open
(
tmp_file_path
)
as
f
:
RESPONSE
.
setHeader
(
'Content-Length'
,
str
(
len
(
r
)))
RESPONSE
.
setHeader
(
'Content-Length'
,
os
.
stat
(
tmp_file_path
).
st_size
)
return
r
for
data
in
f
:
RESPONSE
.
write
(
data
)
if
compressed
:
os
.
remove
(
tmp_file_path
)
return
''
def
__getEventLogPath
(
self
):
def
__getEventLogPath
(
self
):
"""
"""
...
...
product/ERP5Type/Utils.py
View file @
2a5f5ed5
...
@@ -1819,3 +1819,25 @@ class IterableAsStreamIterator:
...
@@ -1819,3 +1819,25 @@ class IterableAsStreamIterator:
for
chunk
in
self
.
iterable
:
for
chunk
in
self
.
iterable
:
return
chunk
return
chunk
raise
StopIteration
raise
StopIteration
@
implementer
(
IStreamIterator
)
class
FileAsStreamIterator
:
def
__init__
(
self
,
file_path
,
remove_file
=
False
):
self
.
file
=
open
(
file_path
)
self
.
size
=
os
.
stat
(
tmp_file_path
).
st_size
self
.
remove_file
=
remove_file
def
__iter__
(
self
):
return
self
def
__len__
(
self
):
return
self
.
size
def
next
(
self
):
for
data
in
self
.
file
:
return
data
self
.
file
.
close
()
if
self
.
remove_file
:
os
.
remove
(
self
.
file
)
raise
StopIteration
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