Simplify encoding/decoding URL parts

This commit is contained in:
Thomas Kluyver 2013-08-12 15:44:06 -07:00 committed by MinRK
parent adb2fc1fa4
commit 213b89c1cc

View File

@ -65,19 +65,11 @@ class NotebookManager(LoggingConfigurable):
def url_encode(self, path):
parts = path.split('/')
path=""
for part in parts:
part = quote(part)
path = os.path.join(path,part)
return path
return os.path.join(*[quote(p) for p in parts])
def url_decode(self, path):
parts = path.split('/')
path=""
for part in parts:
part = unquote(part)
path = os.path.join(path,part)
return path
return os.path.join(*[unquote(p) for p in parts])
def _notebook_dir_changed(self, new):
"""do a bit of validation of the notebook dir"""