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
Titouan Soulard
erp5
Commits
efdb3dbc
Commit
efdb3dbc
authored
Oct 30, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shacache: fix
parent
2a5f5ed5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
bt5/erp5_web_shacache/ExtensionTemplateItem/portal_components/extension.erp5.ShaCache.py
...TemplateItem/portal_components/extension.erp5.ShaCache.py
+15
-11
No files found.
bt5/erp5_web_shacache/ExtensionTemplateItem/portal_components/extension.erp5.ShaCache.py
View file @
efdb3dbc
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
import
hashlib
,
httplib
import
hashlib
,
httplib
from
Products.ERP5Type.UnrestrictedMethod
import
super_user
from
Products.ERP5Type.UnrestrictedMethod
import
super_user
from
Products.ERP5Type.Utils
import
IterableAsStreamIterator
from
zExceptions
import
Success
def
WebSection_getDocumentValue
(
self
,
key
,
portal
=
None
,
language
=
None
,
\
def
WebSection_getDocumentValue
(
self
,
key
,
portal
=
None
,
language
=
None
,
\
...
@@ -71,7 +73,8 @@ def File_viewAsWeb(self):
...
@@ -71,7 +73,8 @@ def File_viewAsWeb(self):
"""
"""
RESPONSE
=
self
.
REQUEST
.
RESPONSE
RESPONSE
=
self
.
REQUEST
.
RESPONSE
RESPONSE
.
setHeader
(
'Content-Type'
,
self
.
getContentType
())
RESPONSE
.
setHeader
(
'Content-Type'
,
self
.
getContentType
())
RESPONSE
.
setHeader
(
'Content-Length'
,
self
.
getSize
())
size
=
self
.
getSize
()
RESPONSE
.
setHeader
(
'Content-Length'
,
size
)
RESPONSE
.
setHeader
(
'Cache-Control'
,
'public,max-age=31556926'
)
RESPONSE
.
setHeader
(
'Cache-Control'
,
'public,max-age=31556926'
)
RESPONSE
.
setHeader
(
'Accept-Ranges'
,
'bytes'
)
RESPONSE
.
setHeader
(
'Accept-Ranges'
,
'bytes'
)
...
@@ -80,18 +83,19 @@ def File_viewAsWeb(self):
...
@@ -80,18 +83,19 @@ def File_viewAsWeb(self):
if
isinstance
(
data
,
str
):
if
isinstance
(
data
,
str
):
# Do this way instead of 'return data'
# Do this way instead of 'return data'
# to bypass default caching policy manager.
# to bypass default caching policy manager.
RESPONSE
.
write
(
data
)
raise
Success
(
data
)
return
# For Pdata type, we must iterate and send chunk by chunk.
# For Pdata type, we must iterate and send chunk by chunk.
# And no need to continue if the client closed the connection.
def
generator
():
while
data
and
not
RESPONSE
.
stdout
.
_channel
.
closed
:
while
data
:
# Send data to the client.
# Send data to the client.
RESPONSE
.
write
(
data
.
data
)
yield
data
.
data
# Load next object without keeping previous chunks in memory.
# Load next object without keeping previous chunks in memory.
deactivate
=
data
.
_p_deactivate
deactivate
=
data
.
_p_deactivate
data
=
data
.
next
data
=
data
.
next
deactivate
()
deactivate
()
return
IterableAsStreamIterator
(
generator
(),
size
)
def
WebSite_viewAsWebPost
(
self
,
*
args
,
**
kwargs
):
def
WebSite_viewAsWebPost
(
self
,
*
args
,
**
kwargs
):
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
...
...
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