diff --git a/atlassian/confluence.py b/atlassian/confluence.py index 22f69936d..43d106216 100644 --- a/atlassian/confluence.py +++ b/atlassian/confluence.py @@ -279,7 +279,8 @@ def remove_page(self, page_id, status=None, recursive=False): params['status'] = status return self.delete(url, params=params) - def create_page(self, space, title, body, parent_id=None, type='page'): + def create_page(self, space, title, body, parent_id=None, type='page', + representation='storage'): """ Create page from scratch :param space: @@ -287,17 +288,20 @@ def create_page(self, space, title, body, parent_id=None, type='page'): :param body: :param parent_id: :param type: + :param representation: OPTIONAL: either Confluence 'storage' or 'wiki' markup format :return: """ log.info('Creating {type} "{space}" -> "{title}"'.format(space=space, title=title, type=type)) + if representation not in ['wiki', 'storage']: + raise ValueError("Wrong value for representation, it should be either wiki or storage") url = 'rest/api/content/' data = { 'type': type, 'title': title, 'space': {'key': space}, - 'body': {'storage': { + 'body': {representation: { 'value': body, - 'representation': 'storage'}}} + 'representation': representation}}} if parent_id: data['ancestors'] = [{'type': type, 'id': parent_id}] return self.post(url, data=data)