Skip to content

Commit fac7243

Browse files
authored
Merge pull request #205 from yoanngoular/master
Add Confluence markup format parameter
2 parents e7fac70 + 46f1240 commit fac7243

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

atlassian/confluence.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,25 +279,29 @@ def remove_page(self, page_id, status=None, recursive=False):
279279
params['status'] = status
280280
return self.delete(url, params=params)
281281

282-
def create_page(self, space, title, body, parent_id=None, type='page'):
282+
def create_page(self, space, title, body, parent_id=None, type='page',
283+
representation='storage'):
283284
"""
284285
Create page from scratch
285286
:param space:
286287
:param title:
287288
:param body:
288289
:param parent_id:
289290
:param type:
291+
:param representation: OPTIONAL: either Confluence 'storage' or 'wiki' markup format
290292
:return:
291293
"""
292294
log.info('Creating {type} "{space}" -> "{title}"'.format(space=space, title=title, type=type))
295+
if representation not in ['wiki', 'storage']:
296+
raise ValueError("Wrong value for representation, it should be either wiki or storage")
293297
url = 'rest/api/content/'
294298
data = {
295299
'type': type,
296300
'title': title,
297301
'space': {'key': space},
298-
'body': {'storage': {
302+
'body': {representation: {
299303
'value': body,
300-
'representation': 'storage'}}}
304+
'representation': representation}}}
301305
if parent_id:
302306
data['ancestors'] = [{'type': type, 'id': parent_id}]
303307
return self.post(url, data=data)

0 commit comments

Comments
 (0)