Skip to content

Commit f70ebaa

Browse files
committed
When updating within a ContentItem, use the fully returned result
1 parent 137ba8b commit f70ebaa

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/posit/connect/content.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ def render(self) -> Task:
214214
--------
215215
>>> render()
216216
"""
217-
self.update() # pyright: ignore[reportCallIssue]
217+
full_content_item: ContentItem = self.update() # pyright: ignore[reportCallIssue]
218218

219-
if self.is_rendered:
220-
variants = self._variants.find()
219+
if full_content_item.is_rendered:
220+
variants = full_content_item._variants.find()
221221
variants = [variant for variant in variants if variant["is_default"]]
222222
if len(variants) != 1:
223223
raise RuntimeError(
@@ -243,16 +243,18 @@ def restart(self) -> None:
243243
--------
244244
>>> restart()
245245
"""
246-
self.update() # pyright: ignore[reportCallIssue]
246+
full_content_item: ContentItem = self.update() # pyright: ignore[reportCallIssue]
247247

248-
if self.is_interactive:
248+
if full_content_item.is_interactive:
249249
unix_epoch_in_seconds = str(int(time.time()))
250250
key = f"_CONNECT_RESTART_TMP_{unix_epoch_in_seconds}"
251-
self.environment_variables.create(key, unix_epoch_in_seconds)
252-
self.environment_variables.delete(key)
251+
full_content_item.environment_variables.create(key, unix_epoch_in_seconds)
252+
full_content_item.environment_variables.delete(key)
253253
# GET via the base Connect URL to force create a new worker thread.
254-
url = posixpath.join(dirname(self._ctx.url), f"content/{self['guid']}")
255-
self._ctx.session.get(url)
254+
url = posixpath.join(
255+
dirname(full_content_item._ctx.url), f"content/{full_content_item['guid']}"
256+
)
257+
full_content_item._ctx.session.get(url)
256258
return None
257259
else:
258260
raise ValueError(

0 commit comments

Comments
 (0)