diff --git a/atlassian/bitbucket.py b/atlassian/bitbucket.py index 4cb2e017b..05a6b05a4 100644 --- a/atlassian/bitbucket.py +++ b/atlassian/bitbucket.py @@ -1239,6 +1239,17 @@ def delete_tag(self, project, repository, tag_name): return self.delete(url) def get_diff(self, project, repository, path, hash_oldest, hash_newest): + """ + Gets a diff of the changes available in the {@code from} commit but not in the {@code to} commit. + If either the {@code from} or {@code to} commit are not specified, + they will be replaced by the default branch of their containing repository. + :param project: + :param repository: + :param path: + :param hash_oldest: the source commit (can be a partial/full commit ID or qualified/unqualified ref name) + :param hash_newest: the target commit (can be a partial/full commit ID or qualified/unqualified ref name) + :return: + """ if not self.cloud: url = 'rest/api/1.0/projects/{project}/repos/{repository}/compare/diff/{path}'.format(project=project, repository=repository, diff --git a/atlassian/confluence.py b/atlassian/confluence.py index e6a790273..7b572028f 100644 --- a/atlassian/confluence.py +++ b/atlassian/confluence.py @@ -416,6 +416,23 @@ def create_page(self, space, title, body, parent_id=None, type='page', data['ancestors'] = [{'type': type, 'id': parent_id}] return self.post(url, data=data) + def move_page(self, space_key, page_id, target_title, position="append"): + """ + Move page method + :param space_key: + :param page_id: + :param target_title: + :param position: topLevel or append + :return: + """ + url = "/pages/movepage.action" + params = {"spaceKey": space_key, "pageId": page_id} + if target_title: + params["targetTitle"] = target_title + if position: + params["position"] = position + return self.get(url, params=params, headers=self.no_check_headers) + def get_all_spaces(self, start=0, limit=500, expand=None): """ Get all spaces with provided limit @@ -714,12 +731,12 @@ def is_page_content_is_already_updated(self, page_id, body, title=None): """ if self.advanced_mode: confluence_content = (((self.get_page_by_id(page_id, expand='body.storage').json() or {}) - .get('body') or {}) - .get('storage') or {}) + .get('body') or {}) + .get('storage') or {}) else: confluence_content = (((self.get_page_by_id(page_id, expand='body.storage') or {}) - .get('body') or {}) - .get('storage') or {}) + .get('body') or {}) + .get('storage') or {}) if title: current_title = confluence_content.get('title', None) @@ -793,8 +810,9 @@ def update_page(self, page_id, title, body, parent_id=None, type='page', represe return self.put('rest/api/content/{0}'.format(page_id), data=data) - def _insert_to_existing_page(self, page_id, title, insert_body, parent_id=None, type='page', representation='storage', - minor_edit=False, top_of_page=False): + def _insert_to_existing_page(self, page_id, title, insert_body, parent_id=None, type='page', + representation='storage', + minor_edit=False, top_of_page=False): """ Insert body to a page if already exist :param parent_id: @@ -849,11 +867,12 @@ def append_page(self, page_id, title, append_body, parent_id=None, type='page', """ log.info('Updating {type} "{title}"'.format(title=title, type=type)) - return self._insert_to_existing_page(page_id, title, append_body, parent_id=parent_id, type=type, representation=representation, - minor_edit=minor_edit, top_of_page=False) + return self._insert_to_existing_page(page_id, title, append_body, parent_id=parent_id, type=type, + representation=representation, + minor_edit=minor_edit, top_of_page=False) def prepend_page(self, page_id, title, prepend_body, parent_id=None, type='page', representation='storage', - minor_edit=False): + minor_edit=False): """ Append body to page if already exist :param parent_id: @@ -868,8 +887,9 @@ def prepend_page(self, page_id, title, prepend_body, parent_id=None, type='page' """ log.info('Updating {type} "{title}"'.format(title=title, type=type)) - return self._insert_to_existing_page(page_id, title, prepend_body, parent_id=parent_id, type=type, representation=representation, - minor_edit=minor_edit, top_of_page=True) + return self._insert_to_existing_page(page_id, title, prepend_body, parent_id=parent_id, type=type, + representation=representation, + minor_edit=minor_edit, top_of_page=True) def update_or_create(self, parent_id, title, body, representation='storage', minor_edit=False): """ diff --git a/atlassian/jira.py b/atlassian/jira.py index 2607873ce..f66baf000 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -231,30 +231,13 @@ def user_update_or_create_property_through_rest_point(self, username, key, value def user_deactivate(self, username): """ - Disable user + Disable user. Works from 8.3.0 Release + https://docs.atlassian.com/software/jira/docs/api/REST/8.3.0/#api/2/user-updateUser :param username: :return: """ - url = 'secure/admin/user/EditUser.jspa' - headers = self.form_token_headers - user = self.user(username) - data = { - 'inline': 'true', - 'decorator': 'dialog', - 'username': user['name'], - 'fullName': user['displayName'], - 'email': user['emailAddress'], - 'editName': user['name'] - } - answer = self.get('secure/admin/WebSudoAuthenticate.jspa', self.form_token_headers) - atl_token = None - if answer: - atl_token = \ - answer.split('