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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
7dab2ee4
Commit
7dab2ee4
authored
Feb 06, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shacache: fix possible MemoryError when uploaded a file
parent
9c786d3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
bt5/erp5_web_shacache/ExtensionTemplateItem/ShaCache.py
bt5/erp5_web_shacache/ExtensionTemplateItem/ShaCache.py
+5
-5
bt5/erp5_web_shacache/bt/revision
bt5/erp5_web_shacache/bt/revision
+1
-1
No files found.
bt5/erp5_web_shacache/ExtensionTemplateItem/ShaCache.py
View file @
7dab2ee4
...
...
@@ -27,7 +27,7 @@
##############################################################################
import
hashlib
import
hashlib
,
httplib
def
WebSection_getDocumentValue
(
self
,
key
,
portal
=
None
,
language
=
None
,
\
...
...
@@ -105,18 +105,18 @@ def File_viewAsWeb(self):
def
WebSite_viewAsWebPost
(
self
,
*
args
,
**
kwargs
):
portal
=
self
.
getPortalObject
()
sha512sum
=
hashlib
.
sha512
()
self
.
REQUEST
.
_file
.
seek
(
0
)
file
=
self
.
REQUEST
.
_file
while
True
:
d
=
self
.
REQUEST
.
_
file
.
read
(
1
<<
20
)
d
=
file
.
read
(
1
<<
20
)
if
not
d
:
break
sha512sum
.
update
(
d
)
sha512sum
=
sha512sum
.
hexdigest
()
document
=
portal
.
portal_contributions
.
newContent
(
data
=
self
.
REQUEST
.
BODY
,
document
=
portal
.
portal_contributions
.
newContent
(
file
=
file
,
filename
=
'shacache'
,
discover_metadata
=
False
,
reference
=
sha512sum
,
content_type
=
'application/octet-stream'
)
document
.
publish
()
self
.
REQUEST
.
RESPONSE
.
setStatus
(
201
)
self
.
REQUEST
.
RESPONSE
.
setStatus
(
httplib
.
CREATED
)
return
sha512sum
bt5/erp5_web_shacache/bt/revision
View file @
7dab2ee4
62
\ No newline at end of file
63
\ 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