# HG changeset patch # User RĂ©mi Cardona # Date 1442928704 -7200 # Node ID 0736e31f8644542a5e641c898bccd2b22998dd99 # Parent 874ac29b515d8fd02a668a43e65b1c79e5755521 [py3k] IDownloadable.download_data() returns bytes diff -r 874ac29b515d -r 0736e31f8644 entities/adapters.py --- a/entities/adapters.py Tue Sep 22 15:24:58 2015 +0200 +++ b/entities/adapters.py Tue Sep 22 15:31:44 2015 +0200 @@ -187,7 +187,7 @@ raise NotImplementedError def download_data(self): - """return actual data of the downloadable content""" + """return actual data (bytes) of the downloadable content""" raise NotImplementedError # XXX should propose to use two different relations for children/parent diff -r 874ac29b515d -r 0736e31f8644 web/test/unittest_idownloadable.py --- a/web/test/unittest_idownloadable.py Tue Sep 22 15:24:58 2015 +0200 +++ b/web/test/unittest_idownloadable.py Tue Sep 22 15:31:44 2015 +0200 @@ -42,7 +42,7 @@ return self.entity.name() + '.txt' def download_data(self): - return 'Babar is not dead!' + return b'Babar is not dead!' class BrokenIDownloadableGroup(IDownloadableUser): @@ -72,7 +72,7 @@ get('content-disposition')) self.assertEqual(['text/plain;charset=ascii'], get('content-type')) - self.assertEqual('Babar is not dead!', data) + self.assertEqual(b'Babar is not dead!', data) def test_header_with_space(self): with self.admin_access.web_request() as req: @@ -87,7 +87,7 @@ get('content-disposition')) self.assertEqual(['text/plain;charset=ascii'], get('content-type')) - self.assertEqual('Babar is not dead!', data) + self.assertEqual(b'Babar is not dead!', data) def test_header_with_space_and_comma(self): with self.admin_access.web_request() as req: @@ -102,7 +102,7 @@ get('content-disposition')) self.assertEqual(['text/plain;charset=ascii'], get('content-type')) - self.assertEqual('Babar is not dead!', data) + self.assertEqual(b'Babar is not dead!', data) def test_header_unicode_filename(self): with self.admin_access.web_request() as req: