Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Update project register routing" #978

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/citrine/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.11.3"
__version__ = "3.11.4"
10 changes: 8 additions & 2 deletions src/citrine/resources/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from citrine._serialization import properties
from citrine._session import Session
from citrine._utils.functions import format_escaped_url
from citrine.exceptions import NonRetryableException, ModuleRegistrationFailedException
from citrine.resources.api_error import ApiError
from citrine.resources.branch import BranchCollection
from citrine.resources.dataset import DatasetCollection
Expand Down Expand Up @@ -591,7 +592,12 @@ def register(self, name: str, *, description: Optional[str] = None) -> Project:
"Use team.projects.register.")

project = Project(name, description=description)
return super().register(project)
try:
data = self.session.post_resource(self._get_path(), project.dump())
data = data[self._individual_key]
return self.build(data)
except NonRetryableException as e:
raise ModuleRegistrationFailedException(project.__class__.__name__, e)

def list(self, *, per_page: int = 1000) -> Iterator[Project]:
"""
Expand Down Expand Up @@ -735,7 +741,7 @@ def delete(self, uid: Union[UUID, str]) -> Response:
If the project is not empty, then the Response will contain a list of all of the project's
resources. These must be deleted before the project can be deleted.
"""
# Only the team-agnostic project delete is implemented
# Only the team-agnostic project get is implemented
if self.team_id is None:
return super().delete(uid)
else:
Expand Down