create pad rework

This commit is contained in:
2023-05-31 21:56:01 +02:00
parent 19e272e9be
commit c05993dcba
2 changed files with 8 additions and 4 deletions

View File

@@ -82,9 +82,12 @@ def create_pad(padID, text="helloworld"):
epc.createGroupPad(groupID=group["groupID"], padName=padID, text=text) epc.createGroupPad(groupID=group["groupID"], padName=padID, text=text)
logger.info(f"neues Pad erzeugt: {padID}") logger.info(f"neues Pad erzeugt: {padID}")
return padID
return None return padID
if __pad_exists(padID=padID):
return padID
else:
raise Exception("Tried to create pad but failed!")
def get_pad_html(padID): def get_pad_html(padID):

View File

@@ -172,8 +172,9 @@ class Etherpad(models.Model):
if self.etherpad_key is None: if self.etherpad_key is None:
self.etherpad_key = create_pad(pad_name) self.etherpad_key = create_pad(pad_name)
if self.etherpad_key is None: if self.etherpad_key is None:
raise ValidationError(f"Etherpad '{pad_name}' konnte nicht erstellt werden.") raise ValidationError(f"Etherpad '{pad_name}' konnte nicht erstellt werden. This should never happen!")
@property @property
def etherpad_html(self): def etherpad_html(self):