aboutsummaryrefslogtreecommitdiffstats
path: root/slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2022-10-24 20:15:52 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:52 +0100
commita8e564d25a0178a488b0b7834cc60a0dbfa0215a (patch)
treeeb85a79fb666ced27a5564dd0822c75993f01a3b /slack.py
parentf22edb24f61cebe26903eaaf05a3f834ef790557 (diff)
downloadwee-slack-a8e564d25a0178a488b0b7834cc60a0dbfa0215a.tar.gz
Only pass workspace name to config
Diffstat (limited to 'slack.py')
-rw-r--r--slack.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/slack.py b/slack.py
index 0ff0362..080d22e 100644
--- a/slack.py
+++ b/slack.py
@@ -414,11 +414,11 @@ class SlackConfigSectionWorkspace:
def __init__(
self,
section: WeeChatSection,
- workspace: Union[SlackWorkspace, None],
+ workspace_name: Union[str, None],
parent_config: Union[SlackConfigSectionWorkspace, None],
):
self._section = section
- self._workspace = workspace
+ self._workspace_name = workspace_name
self._parent_config = parent_config
self.api_token = self._create_option(
@@ -448,8 +448,8 @@ class SlackConfigSectionWorkspace:
max_value: Union[int, None] = None,
string_values: Union[str, None] = None,
) -> WeeChatOption[WeeChatOptionType]:
- if self._workspace:
- option_name = f"{self._workspace.name}.{name}"
+ if self._workspace_name:
+ option_name = f"{self._workspace_name}.{name}"
else:
option_name = name
@@ -552,13 +552,13 @@ class SlackConfig:
def config_read(self):
weechat.config_read(self.weechat_config.pointer)
- def create_workspace_config(self, workspace: SlackWorkspace):
- if workspace.name in workspaces:
+ def create_workspace_config(self, workspace_name: str):
+ if workspace_name in workspaces:
raise Exception(
- f"Failed to create workspace config, already exists: {workspace.name}"
+ f"Failed to create workspace config, already exists: {workspace_name}"
)
return SlackConfigSectionWorkspace(
- self._section_workspace, workspace, self._workspace_default
+ self._section_workspace, workspace_name, self._workspace_default
)
@@ -602,7 +602,7 @@ class SlackApi:
class SlackWorkspace:
def __init__(self, name: str):
self.name = name
- self.config = config.create_workspace_config(self)
+ self.config = config.create_workspace_config(self.name)
self.api = SlackApi(self)