Skip to content

Commit

Permalink
- unit tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jan 29, 2020
1 parent 755d065 commit 43515a7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 640 deletions.
2 changes: 2 additions & 0 deletions src/OFS/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ def PUT(self, REQUEST, RESPONSE):
file = REQUEST['BODYFILE']

data, size = self._read_data(file)
if isinstance(data, str):
data = data.encode('UTF-8')
content_type = self._get_content_type(file, data, self.__name__,
type or self.content_type)
self.update_data(data, content_type, size)
Expand Down
5 changes: 2 additions & 3 deletions src/OFS/tests/testFileAndImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ def testIfModSince(self):
self.assertEqual(data, bytes(self.file.data))

def testPUT(self):
import pdb; pdb.set_trace()
s = b'# some python\n'

# with content type
Expand All @@ -266,7 +265,7 @@ def testPUT(self):
self.file.PUT(req, req.RESPONSE)

self.assertEqual(self.file.content_type, 'text/x-python')
self.assertEqual(str(self.file.data), s)
self.assertEqual(self.file.data, s)

# without content type
data.seek(0)
Expand All @@ -275,7 +274,7 @@ def testPUT(self):
self.file.PUT(req, req.RESPONSE)

self.assertEqual(self.file.content_type, 'text/x-python')
self.assertEqual(str(self.file.data), s)
self.assertEqual(self.file.data, s)

def testIndexHtmlWithPdata(self):
self.file.manage_upload(b'a' * (2 << 16)) # 128K
Expand Down
2 changes: 1 addition & 1 deletion src/webdav/NullResource.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def PUT(self, REQUEST, RESPONSE):
body = file.read(LARGE_FILE_THRESHOLD)
file.seek(0)
else:
body = REQUEST.get('BODY', '')
body = REQUEST.get('BODY', b'')

typ = REQUEST.get_header('content-type', None)
if typ is None:
Expand Down
2 changes: 1 addition & 1 deletion src/webdav/PropertySheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def xml_escape(value):
if not isinstance(value, str):
value = value.decode('utf-8')
value = escape(value)
return value.encode('utf-8')
return value


class DAVPropertySheetMixin(object):
Expand Down
Loading

0 comments on commit 43515a7

Please sign in to comment.