def create_workspace( self, label: str = '', description: str = '', calendar_enabled: bool = False, save_now: bool = False, ) -> Workspace: if not label: label = self.generate_label() workspace = Workspace() workspace.label = label workspace.description = description workspace.calendar_enabled = calendar_enabled # By default, we force the current user to be the workspace manager # And to receive email notifications role = RoleApi(self._user).create_one( self._user, workspace, UserRoleInWorkspace.WORKSPACE_MANAGER, with_notif=True) DBSession.add(workspace) DBSession.add(role) if save_now: DBSession.flush() if calendar_enabled: self.ensure_calendar_exist(workspace) else: self.disable_calendar(workspace) return workspace
def create_workspace( self, label: str='', description: str='', calendar_enabled: bool=False, save_now: bool=False, ) -> Workspace: if not label: label = self.generate_label() workspace = Workspace() workspace.label = label workspace.description = description workspace.calendar_enabled = calendar_enabled # By default, we force the current user to be the workspace manager # And to receive email notifications role = RoleApi(self._user).create_one(self._user, workspace, UserRoleInWorkspace.WORKSPACE_MANAGER, with_notif=True) DBSession.add(workspace) DBSession.add(role) if save_now: DBSession.flush() if calendar_enabled: self.ensure_calendar_exist(workspace) else: self.disable_calendar(workspace) return workspace
def create_workspace(self, label: str, description: str='', save_now:bool=False) -> Workspace: workspace = Workspace() workspace.label = label workspace.description = description # By default, we force the current user to be the workspace manager # And to receive email notifications role = RoleApi(self._user).create_one(self._user, workspace, UserRoleInWorkspace.WORKSPACE_MANAGER, with_notif=True) DBSession.add(workspace) DBSession.add(role) if save_now: DBSession.flush() return workspace
def create_workspace(self, label: str, description: str = '', save_now: bool = False) -> Workspace: workspace = Workspace() workspace.label = label workspace.description = description # By default, we force the current user to be the workspace manager # And to receive email notifications role = RoleApi(self._user).create_one( self._user, workspace, UserRoleInWorkspace.WORKSPACE_MANAGER, with_notif=True) DBSession.add(workspace) DBSession.add(role) if save_now: DBSession.flush() return workspace