diff --git a/deluge/tests/test_web_api.py b/deluge/tests/test_web_api.py index 9b68b225c..d580214a0 100644 --- a/deluge/tests/test_web_api.py +++ b/deluge/tests/test_web_api.py @@ -155,7 +155,8 @@ class WebAPITestCase(WebServerTestBase): @defer.inlineCallbacks def test_download_torrent_from_url(self): filename = 'ubuntu-9.04-desktop-i386.iso.torrent' - self.deluge_web.top_level.putChild(filename, File(common.get_test_data_file(filename))) + self.deluge_web.top_level.putChild( + filename.encode(), File(common.get_test_data_file(filename))) url = 'http://localhost:%d/%s' % (self.webserver_listen_port, filename) res = yield self.deluge_web.web_api.download_torrent_from_url(url) self.assertTrue(res.endswith(filename)) diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index 8e84c040d..fe8bee6c3 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -444,17 +444,17 @@ class TopLevel(resource.Resource): def __init__(self): resource.Resource.__init__(self) - self.putChild('css', LookupResource('Css', rpath('css'))) + self.putChild(b'css', LookupResource('Css', rpath('css'))) if os.path.isfile(rpath('js', 'gettext.js')): - self.putChild('gettext.js', GetText()) + self.putChild(b'gettext.js', GetText()) else: log.warning( 'Cannot find "gettext.js" translation file!' ' Text will only be available in English.') - self.putChild('gettext.js', MockGetText()) - self.putChild('flag', Flag()) - self.putChild('icons', LookupResource('Icons', rpath('icons'))) - self.putChild('images', LookupResource('Images', rpath('images'))) + self.putChild(b'gettext.js', MockGetText()) + self.putChild(b'flag', Flag()) + self.putChild(b'icons', LookupResource('Icons', rpath('icons'))) + self.putChild(b'images', LookupResource('Images', rpath('images'))) js = ScriptResource() @@ -477,12 +477,12 @@ class TopLevel(resource.Resource): js.add_script('deluge-all.js', rpath('js', 'deluge-all.js')) self.js = js - self.putChild('js', js) - self.putChild('json', JSON()) - self.putChild('upload', Upload()) - self.putChild('render', Render()) - self.putChild('themes', static.File(rpath('themes'))) - self.putChild('tracker', Tracker()) + self.putChild(b'js', js) + self.putChild(b'json', JSON()) + self.putChild(b'upload', Upload()) + self.putChild(b'render', Render()) + self.putChild(b'themes', static.File(rpath('themes'))) + self.putChild(b'tracker', Tracker()) theme = component.get('DelugeWeb').config['theme'] if not os.path.isfile(rpath('themes', 'css', 'xtheme-%s.css' % theme)):