Skip to content

Commit f9ba354

Browse files
authored
Add Confluence update_page(always_update) and get_space(params) methods (#733)
- update_page(always_update=False) allows the content check to be overridded - get_space(params=None) allows params to be passed, e.g. type and status
1 parent 65553cd commit f9ba354

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

atlassian/confluence.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,7 @@ def update_page(
12551255
representation="storage",
12561256
minor_edit=False,
12571257
version_comment=None,
1258+
always_update=False,
12581259
):
12591260
"""
12601261
Update page if already exist
@@ -1267,11 +1268,12 @@ def update_page(
12671268
:param minor_edit: Indicates whether to notify watchers about changes.
12681269
If False then notifications will be sent.
12691270
:param version_comment: Version comment
1271+
:param always_update: Whether always to update (suppress content check)
12701272
:return:
12711273
"""
12721274
log.info('Updating {type} "{title}"'.format(title=title, type=type))
12731275

1274-
if body is not None and self.is_page_content_is_already_updated(page_id, body, title):
1276+
if not always_update and body is not None and self.is_page_content_is_already_updated(page_id, body, title):
12751277
return self.get_page_by_id(page_id)
12761278

12771279
try:
@@ -1768,15 +1770,16 @@ def get_all_members(self, group_name="confluence-users", expand=None):
17681770
print("Did not get members from {} group, please check permissions or connectivity".format(group_name))
17691771
return members
17701772

1771-
def get_space(self, space_key, expand="description.plain,homepage"):
1773+
def get_space(self, space_key, expand="description.plain,homepage", params=None):
17721774
"""
17731775
Get information about a space through space key
17741776
:param space_key: The unique space key name
17751777
:param expand: OPTIONAL: additional info from description, homepage
1778+
:param params: OPTIONAL: dictionary of additional URL parameters
17761779
:return: Returns the space along with its ID
17771780
"""
17781781
url = "rest/api/space/{space_key}".format(space_key=space_key)
1779-
params = {}
1782+
params = params or {}
17801783
if expand:
17811784
params["expand"] = expand
17821785
try:

0 commit comments

Comments
 (0)