From f20aefee6817632de2cb3f91e508b86cb7c75344 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Thu, 13 Jun 2024 09:10:58 -0400 Subject: [PATCH] Update src/posit/connect/content.py Co-authored-by: Neal Richardson --- src/posit/connect/content.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/posit/connect/content.py b/src/posit/connect/content.py index 4461a508..58edec42 100644 --- a/src/posit/connect/content.py +++ b/src/posit/connect/content.py @@ -149,11 +149,12 @@ def permissions(self) -> Permissions: @property def owner(self) -> ContentItemOwner: - if "owner" in self: - return self["owner"] - user = Users(self.config, self.session).get(self.owner_guid) - owner = ContentItemOwner(self.config, self.session, **user) - return owner + if "owner" not in self: + # It is possible to get a content item that does not contain owner. + # "owner" is an optional additional request param. + # If it's not included, we can retrieve the information by `owner_guid` + self["owner"] = Users(self.config, self.session).get(self.owner_guid) + return ContentItemOwner(self.config, self.session, **self["owner"]) # Properties