Skip to content

Commit

Permalink
[Confluence] Expand parameter addition for get_draft_page_by_id (#1388)
Browse files Browse the repository at this point in the history
* Updated get_draft_page_by_id to call get_page_by_id since that's all it did anyway

* Adding the status param back to avoid breaking existing scripts

* removed my previous status hardcoding

* formatting with black

---------

Co-authored-by: Austin Heil <austin.heil@saabinc.com>
  • Loading branch information
austinmh12 and Austin Heil committed May 16, 2024
1 parent 591ca2c commit 588f365
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
29 changes: 11 additions & 18 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,27 +506,20 @@ def get_page_comments(

return response

def get_draft_page_by_id(self, page_id, status="draft"):
def get_draft_page_by_id(self, page_id, status="draft", expand=None):
"""
Provide content by id with status = draft
:param page_id:
:param status:
Gets content by id with status = draft
:param page_id: Content ID
:param status: (str) list of content statuses to filter results on. Default value: [draft]
:param expand: OPTIONAL: Default value: history,space,version
We can also specify some extensions such as extensions.inlineProperties
(for getting inline comment-specific properties) or extensions. Resolution
for the resolution status of each comment in the results
:return:
"""
url = "rest/api/content/{page_id}?status={status}".format(page_id=page_id, status=status)

try:
response = self.get(url)
except HTTPError as e:
if e.response.status_code == 404:
raise ApiPermissionError(
"The calling user does not have permission to view the content",
reason=e,
)

raise

return response
# Version not passed since draft versions don't match the page and
# operate differently between different collaborative modes
return self.get_page_by_id(page_id=page_id, expand=expand, status=status)

def get_all_pages_by_label(self, label, start=0, limit=50):
"""
Expand Down
2 changes: 1 addition & 1 deletion atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ def issue_field_value_append(self, issue_id_or_key, field, value, notify_users=T
else:
new_value = [value]

fields = {'{}'.format(field): new_value}
fields = {"{}".format(field): new_value}

return self.put(
"{base_url}/{key}".format(base_url=base_url, key=issue_id_or_key),
Expand Down

0 comments on commit 588f365

Please sign in to comment.