fixed etherpad link

This commit is contained in:
root (fetsite6)
2020-10-19 20:44:40 +02:00
parent 460b9ba32a
commit c6fdd1c399
2 changed files with 18 additions and 5 deletions

View File

@@ -18,6 +18,8 @@ def get_ep_client():
try:
with open(os.path.abspath(settings.ETHERPAD_CLIENT["apikey"]), "r") as f:
apikey = f.read()
apikey = apikey.rstrip()
#logger.info(apikey)
epc = EtherpadLiteClient(
base_params={'apikey': apikey, },
base_url=urllib.parse.urljoin(settings.ETHERPAD_CLIENT["url"], "api"),
@@ -26,7 +28,8 @@ def get_ep_client():
group = epc.createGroupIfNotExistsFor(groupMapper="fet")
except Exception as e:
logger.info("Can't get connection to Etherpad Server. Error: {}".format(e))
return None, None
raise e
return None,None
return epc, group
@@ -54,17 +57,23 @@ def __checkPadExists(padID=None):
def createPadifNotExists(padID):
epc, group = get_ep_client()
if not epc:
logger.info("meh, not EPC")
return None
# Pad doesn't exist
if not __checkPadExists(padID=padID):
try:
logger.info("trying creategrouppad")
epc.createGroupPad(groupID=group["groupID"], padName=padID, text="helloworld")
except EtherpadException as e:
# TODO: change it after Etherpad server is a better one than that because of http 500
logger.info("print e")
print(e)
return None
except Exception as e:
logger.info("raise e")
raise e
logger.info(padID)
return padID