Skip to content

Commit d6942d5

Browse files
alexbruywonder-sk
authored andcommitted
implement workspace_id getter
1 parent 8ac86fd commit d6942d5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mergin/merginproject.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,16 @@ def workspace_id(self) -> int:
182182
"""Returns ID of the workspace where the project belongs"""
183183
# unfortunately we currently do not have information about workspace ID
184184
# in project's metadata...
185-
raise NotImplementedError
185+
if self._metadata is None:
186+
self._read_metadata()
187+
188+
# "workspace_id" does not exist in projects downloaded with old client version
189+
if self.is_old_metadata:
190+
raise ClientError(
191+
"The project directory has been created with an old version of the Mergin Maps client. "
192+
"Please delete the project directory and re-download the project."
193+
)
194+
return self._metadata["workspace_id"]
186195

187196
def version(self) -> str:
188197
"""Returns project version (e.g. "v123")"""

0 commit comments

Comments
 (0)