Repository navigation
[Confluence] ConfluenceCloud: add create_page and update_page - #1699
Open
LuisFigueroaG wants to merge 1 commit into
Open
LuisFigueroaG wants to merge 1 commit into
LuisFigueroaG wants to merge 1 commit into
Conversation
Confluence(url="https://<site>.atlassian.net") and ConfluenceCloud return the legacy Cloud client, which had no create_page/update_page, so code written against 4.x fails with "'Cloud' object has no attribute 'update_page'". Add both with the same arguments as the Server client, sending them to /wiki/rest/api/content like the rest of the Cloud content methods. _create_body moves to the shared base so both clients use it.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #1686,
Confluence(url="https://<site>.atlassian.net", ...)andfrom atlassian.confluence import ConfluenceCloudboth fail with:With a Cloud URL,
Confluencepasses calls to the legacyCloudclient (ConfluenceCloud), and since the client split that class has had nocreate_pageorupdate_page. Code written against 4.x has nothing to call on Cloud exceptConfluenceV2, which takes different arguments (space ID instead of key, and so on).This adds both to
Cloud, with the same arguments as the Server client:create_page(space, title, body, parent_id=None, ...)POSTs to/wiki/rest/api/contentwith the space key.update_page(page_id, title, body=None, parent_id=None, ...)reads the page (expand=body.storage,version), returns it as is when the title and body already match (unlessalways_update=True), and otherwise PUTs the next version to/wiki/rest/api/content/{id}.These are the same v1 content endpoints the class already uses for
get_page_by_id,create_contentandupdate_content._create_bodymoves fromServerto the sharedConfluenceBaseso both clients use it; Server behaviour doesn't change.The
parent_iderror withConfluenceV2from the same issue was fixed in #1692, so this covers the rest of it.Fixes #1686
Added three tests in
tests/confluence/test_confluence_cloud.py, one of them callingupdate_pagethroughConfluence(url="https://test.atlassian.net"); they fail on master with the error from the issue. The full pytest suite, mypy, bandit and doc8 pass; flake8 and black only report the files underexamples/that already fail on master. I haven't run it against a real Cloud site.