fix condition

This commit is contained in:
2024-08-09 14:10:20 +02:00
parent 555f4ebe49
commit 9408208ed6

View File

@@ -56,7 +56,21 @@ def get_ep_group(ep_group_name: str = "fet") -> dict[str, str]:
return ep_group return ep_group
def ep_pad_exists(pad_id: str | None = None): def ep_pad_exists(pad_id: str | None = None) -> (bool | None):
""" Check if pad exists.
Parameters
----------
pad_id : str | None
Id of pad that is checked if it exists.
Returns
-------
bool | None
- True: Pad exists.
- False: Pad doesn't exist.
- None: There is no pad id or no connection to etherpad server.
"""
if pad_id is None: if pad_id is None:
return None return None
@@ -90,7 +104,7 @@ def ep_create_new_pad(pad_id: str | None, text="helloworld"):
if (ep_group := get_ep_group()) is None: if (ep_group := get_ep_group()) is None:
return None return None
if ep_pad_exists(pad_id) is True: if ep_pad_exists(pad_id) is False:
ep_c.createGroupPad(groupID=ep_group["groupID"], padName=pad_id, text=text) ep_c.createGroupPad(groupID=ep_group["groupID"], padName=pad_id, text=text)
logger.info(f"Create new etherpad. Pad: {pad_id}") logger.info(f"Create new etherpad. Pad: {pad_id}")
return pad_id return pad_id