Skip to content

Commit 497aeaa

Browse files
authored
Confluence: Added the ability to create_page in confluence.py to set page full width. Default is False to make it how it is today. (atlassian-api#995)
1 parent 82293a2 commit 497aeaa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

atlassian/confluence.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ def create_page(
673673
type="page",
674674
representation="storage",
675675
editor=None,
676+
full_width=False,
676677
):
677678
"""
678679
Create page from scratch
@@ -683,6 +684,7 @@ def create_page(
683684
:param type:
684685
:param representation: OPTIONAL: either Confluence 'storage' or 'wiki' markup format
685686
:param editor: OPTIONAL: v2 to be created in the new editor
687+
:param full_width: DEFAULT: False
686688
:return:
687689
"""
688690
log.info('Creating {type} "{space}" -> "{title}"'.format(space=space, title=title, type=type))
@@ -692,11 +694,15 @@ def create_page(
692694
"title": title,
693695
"space": {"key": space},
694696
"body": self._create_body(body, representation),
697+
"metadata": {"properties": {}},
695698
}
696699
if parent_id:
697700
data["ancestors"] = [{"type": type, "id": parent_id}]
698701
if editor is not None and editor in ["v1", "v2"]:
699-
data["metadata"] = {"properties": {"editor": {"value": editor}}}
702+
data["metadata"]["properties"]["editor"] = {"value": editor}
703+
if full_width is True:
704+
data["metadata"]["properties"]["content-appearance-draft"] = {"value": "full-width"}
705+
data["metadata"]["properties"]["content-appearance-published"] = {"value": "full-width"}
700706
try:
701707
response = self.post(url, data=data)
702708
except HTTPError as e:

0 commit comments

Comments
 (0)