diff --git a/utils.py b/utils.py index d4ce449ea717abc0f7829c008f0b4cb624fd1211..1ac0c4d4309c7011440689719eded63832e72cbc 100644 --- a/utils.py +++ b/utils.py @@ -108,15 +108,17 @@ def get_first_unused_int(numbers): return linear return highest + 1 +def normalize_pad(pad): + return pad.replace(" ", "_") def get_etherpad_url(pad): - return "{}/p/{}".format(config.ETHERPAD_URL, pad) + return "{}/p/{}".format(config.ETHERPAD_URL, normalize_pad(pad)) def get_etherpad_export_url(pad): - return "{}/p/{}/export/txt".format(config.ETHERPAD_URL, pad) + return "{}/p/{}/export/txt".format(config.ETHERPAD_URL, normalize_pad(pad)) def get_etherpad_import_url(pad): - return "{}/p/{}/import".format(config.ETHERPAD_URL, pad) + return "{}/p/{}/import".format(config.ETHERPAD_URL, normalize_pad(pad)) def get_etherpad_text(pad): - req = requests.get("{}/p/{}/export/txt".format(config.ETHERPAD_URL, pad)) + req = requests.get(get_etherpad_export_url(pad)) return req.text def set_etherpad_text(pad, text, only_if_default=True):