Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
78a7ee19
Commit
78a7ee19
authored
Apr 10, 2010
by
I want to see all private code of nexedi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using multifile and use email instead.
parent
b5b32ac6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
src/OFS/tests/testRanges.py
src/OFS/tests/testRanges.py
+7
-18
No files found.
src/OFS/tests/testRanges.py
View file @
78a7ee19
...
...
@@ -178,9 +178,8 @@ class TestRequestRange(unittest.TestCase):
def
expectMultipleRanges
(
self
,
range
,
sets
,
draft
=
0
):
import
cStringIO
from
mimetools
import
Message
from
multifile
import
MultiFile
import
re
import
email
rangeParse
=
re
.
compile
(
'bytes
\
s*(
\
d+)-(
\
d+)/(
\
d+)'
)
req
=
self
.
app
.
REQUEST
rsp
=
req
.
RESPONSE
...
...
@@ -211,20 +210,16 @@ class TestRequestRange(unittest.TestCase):
# Decode the multipart message
bodyfile
=
cStringIO
.
StringIO
(
'Content-Type: %s
\
n
\
n
%s'
%
(
rsp
.
getHeader
(
'content-type'
),
body
))
bodymessage
=
Message
(
bodyfile
)
partfiles
=
MultiFile
(
bodyfile
)
partfiles
.
push
(
bodymessage
.
getparam
(
'boundary'
))
partmessages
=
[]
add
=
partmessages
.
append
while
partfiles
.
next
():
add
(
Message
(
cStringIO
.
StringIO
(
partfiles
.
read
())))
partmessages
=
[
part
for
part
in
email
.
message_from_file
(
bodyfile
).
walk
()]
# Check the different parts
returnedRanges
=
[]
add
=
returnedRanges
.
append
for
part
in
partmessages
:
range
=
part
[
'content-range'
]
if
part
.
get_content_maintype
()
==
'multipart'
:
continue
range
=
part
.
get
(
'content-range'
)
start
,
end
,
size
=
rangeParse
.
search
(
range
).
groups
()
start
,
end
,
size
=
int
(
start
),
int
(
end
),
int
(
size
)
end
=
end
+
1
...
...
@@ -233,13 +228,7 @@ class TestRequestRange(unittest.TestCase):
'Part Content-Range header reported incorrect length. '
'Expected %d, got %d.'
%
(
len
(
self
.
data
),
size
))
part
.
rewindbody
()
body
=
part
.
fp
.
read
()
# Whotcha! Bug in MultiFile; the CRLF that is part of the boundary
# is returned as part of the body. Note that this bug is resolved
# in Python 2.2.
if
body
[
-
2
:]
==
'
\
r
\
n
'
:
body
=
body
[:
-
2
]
body
=
part
.
get_payload
()
self
.
failIf
(
len
(
body
)
!=
end
-
start
,
'Part (%d, %d) is of wrong length, expected %d, got %d.'
%
(
...
...
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