[elbe-devel] [PATCH 03/22] elbepack: projectmanager: add allow_busy to open_project()
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Aug 14 15:29:17 CEST 2024
To replace _get_current_project() by open_project(), this parameter
needs to be supported.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/projectmanager.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 81961f5801ab..2c2581e196d4 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -103,7 +103,8 @@ class ProjectManager:
self,
userid,
builddir,
- url_validation=ValidationMode.CHECK_ALL):
+ url_validation=ValidationMode.CHECK_ALL,
+ allow_busy=True):
self._check_project_permission(userid, builddir)
with self.lock:
@@ -111,7 +112,10 @@ class ProjectManager:
if self.builddir2userid[builddir] == userid:
# Same project selected again by the same user, don't do
# anything
- return self.userid2project[userid]
+ ep = self.userid2project[userid]
+ if not allow_busy:
+ self._assert_not_busy(ep)
+ return ep
# Already opened by a different user
raise AlreadyOpen(builddir,
@@ -128,6 +132,8 @@ class ProjectManager:
self.userid2project[userid] = ep
self.builddir2userid[builddir] = userid
+ if not allow_busy:
+ self._assert_not_busy(ep)
return ep
def close_current_project(self, userid):
--
2.46.0
More information about the elbe-devel
mailing list