Skip to content
Snippets Groups Projects
Commit fde416aa authored by Administrator's avatar Administrator
Browse files

Correctly handle whitespace in etherpad identifiers

parent ae4c847c
No related branches found
No related tags found
No related merge requests found
...@@ -108,15 +108,17 @@ def get_first_unused_int(numbers): ...@@ -108,15 +108,17 @@ def get_first_unused_int(numbers):
return linear return linear
return highest + 1 return highest + 1
def normalize_pad(pad):
return pad.replace(" ", "_")
def get_etherpad_url(pad): 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): 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): 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): 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 return req.text
def set_etherpad_text(pad, text, only_if_default=True): def set_etherpad_text(pad, text, only_if_default=True):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment