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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
3f58706e
Commit
3f58706e
authored
Aug 27, 2014
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BigFile: Simplify use of iterator.
parent
2f9dc41e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
18 deletions
+6
-18
product/ERP5/Document/BigFile.py
product/ERP5/Document/BigFile.py
+6
-18
No files found.
product/ERP5/Document/BigFile.py
View file @
3f58706e
...
...
@@ -201,12 +201,8 @@ class BigFile(File):
if
isinstance
(
data
,
str
):
RESPONSE
.
write
(
data
[
start
:
end
])
return
True
iterator
=
data
.
iterate
(
start
,
end
-
start
)
try
:
while
1
:
RESPONSE
.
write
(
iterator
.
next
())
except
StopIteration
:
pass
for
chunk
in
data
.
iterate
(
start
,
end
-
start
):
RESPONSE
.
write
(
chunk
)
return
True
else
:
...
...
@@ -251,12 +247,8 @@ class BigFile(File):
RESPONSE
.
write
(
data
[
start
:
end
])
else
:
iterator
=
data
.
iterate
(
start
,
end
-
start
)
try
:
while
1
:
RESPONSE
.
write
(
iterator
.
next
())
except
StopIteration
:
pass
for
chunk
in
data
.
iterate
(
start
,
end
-
start
):
RESPONSE
.
write
(
chunk
)
RESPONSE
.
write
(
'
\
r
\
n
--%s--
\
r
\
n
'
%
boundary
)
return
True
...
...
@@ -301,12 +293,8 @@ class BigFile(File):
if
data
is
None
:
return
''
iterator
=
data
.
iterate
()
try
:
while
1
:
RESPONSE
.
write
(
iterator
.
next
())
except
StopIteration
:
pass
for
chunk
in
data
.
iterate
():
RESPONSE
.
write
(
chunk
)
return
''
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'PUT'
)
...
...
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