Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
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
Hide 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):
...
@@ -201,12 +201,8 @@ class BigFile(File):
if
isinstance
(
data
,
str
):
if
isinstance
(
data
,
str
):
RESPONSE
.
write
(
data
[
start
:
end
])
RESPONSE
.
write
(
data
[
start
:
end
])
return
True
return
True
iterator
=
data
.
iterate
(
start
,
end
-
start
)
for
chunk
in
data
.
iterate
(
start
,
end
-
start
):
try
:
RESPONSE
.
write
(
chunk
)
while
1
:
RESPONSE
.
write
(
iterator
.
next
())
except
StopIteration
:
pass
return
True
return
True
else
:
else
:
...
@@ -251,12 +247,8 @@ class BigFile(File):
...
@@ -251,12 +247,8 @@ class BigFile(File):
RESPONSE
.
write
(
data
[
start
:
end
])
RESPONSE
.
write
(
data
[
start
:
end
])
else
:
else
:
iterator
=
data
.
iterate
(
start
,
end
-
start
)
for
chunk
in
data
.
iterate
(
start
,
end
-
start
):
try
:
RESPONSE
.
write
(
chunk
)
while
1
:
RESPONSE
.
write
(
iterator
.
next
())
except
StopIteration
:
pass
RESPONSE
.
write
(
'
\
r
\
n
--%s--
\
r
\
n
'
%
boundary
)
RESPONSE
.
write
(
'
\
r
\
n
--%s--
\
r
\
n
'
%
boundary
)
return
True
return
True
...
@@ -301,12 +293,8 @@ class BigFile(File):
...
@@ -301,12 +293,8 @@ class BigFile(File):
if
data
is
None
:
if
data
is
None
:
return
''
return
''
iterator
=
data
.
iterate
()
for
chunk
in
data
.
iterate
():
try
:
RESPONSE
.
write
(
chunk
)
while
1
:
RESPONSE
.
write
(
iterator
.
next
())
except
StopIteration
:
pass
return
''
return
''
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'PUT'
)
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