Skip to content

Commit 588f365

Browse files
austinmh12Austin Heil
andauthored
[Confluence] Expand parameter addition for get_draft_page_by_id (#1388)
* 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>
1 parent 591ca2c commit 588f365

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

atlassian/confluence.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -506,27 +506,20 @@ def get_page_comments(
506506

507507
return response
508508

509-
def get_draft_page_by_id(self, page_id, status="draft"):
509+
def get_draft_page_by_id(self, page_id, status="draft", expand=None):
510510
"""
511-
Provide content by id with status = draft
512-
:param page_id:
513-
:param status:
511+
Gets content by id with status = draft
512+
:param page_id: Content ID
513+
:param status: (str) list of content statuses to filter results on. Default value: [draft]
514+
:param expand: OPTIONAL: Default value: history,space,version
515+
We can also specify some extensions such as extensions.inlineProperties
516+
(for getting inline comment-specific properties) or extensions. Resolution
517+
for the resolution status of each comment in the results
514518
:return:
515519
"""
516-
url = "rest/api/content/{page_id}?status={status}".format(page_id=page_id, status=status)
517-
518-
try:
519-
response = self.get(url)
520-
except HTTPError as e:
521-
if e.response.status_code == 404:
522-
raise ApiPermissionError(
523-
"The calling user does not have permission to view the content",
524-
reason=e,
525-
)
526-
527-
raise
528-
529-
return response
520+
# Version not passed since draft versions don't match the page and
521+
# operate differently between different collaborative modes
522+
return self.get_page_by_id(page_id=page_id, expand=expand, status=status)
530523

531524
def get_all_pages_by_label(self, label, start=0, limit=50):
532525
"""

atlassian/jira.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ def issue_field_value_append(self, issue_id_or_key, field, value, notify_users=T
13551355
else:
13561356
new_value = [value]
13571357

1358-
fields = {'{}'.format(field): new_value}
1358+
fields = {"{}".format(field): new_value}
13591359

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

0 commit comments

Comments
 (0)