@@ -313,7 +313,7 @@ def get_page_by_title(self, space, title, start=0, limit=1, expand=None, type="p
313
313
try :
314
314
return response .get ("results" )[0 ]
315
315
except (IndexError , TypeError ) as e :
316
- log .error ("Can't find '{title} ' page on the {url}!" . format ( title = title , url = self .url ) )
316
+ log .error ("Can't find '%s ' page on the %s!" , title , self .url )
317
317
log .debug (e )
318
318
return None
319
319
@@ -745,7 +745,7 @@ def create_page(
745
745
:param full_width: DEFAULT: False
746
746
:return:
747
747
"""
748
- log .info ('Creating {type} "{space} " -> "{title}"' . format ( space = space , title = title , type = type ) )
748
+ log .info ('Creating %s "%s " -> "%s"' , type , space , title )
749
749
url = "rest/api/content/"
750
750
data = {
751
751
"type" : type ,
@@ -1302,12 +1302,12 @@ def remove_page_attachment_keep_version(self, page_id, filename, keep_last_versi
1302
1302
version = remove_version_attachment_number ,
1303
1303
)
1304
1304
log .info (
1305
- "Removed oldest version for {} , now versions equal more than {}" . format (
1306
- attachment .get ("title" ), len ( attachment_versions )
1307
- )
1305
+ "Removed oldest version for %s , now versions equal more than %s" ,
1306
+ attachment .get ("title" ),
1307
+ len ( attachment_versions ),
1308
1308
)
1309
1309
attachment_versions = self .get_attachment_history (attachment .get ("id" ))
1310
- log .info ("Kept versions {} for {}" . format ( keep_last_versions , attachment .get ("title" ) ))
1310
+ log .info ("Kept versions %s for %s" , keep_last_versions , attachment .get ("title" ))
1311
1311
1312
1312
def get_attachment_history (self , attachment_id , limit = 200 , start = 0 ):
1313
1313
"""
@@ -1506,8 +1506,8 @@ def remove_page_history_keep_version(self, page_id, keep_last_versions):
1506
1506
self .remove_page_history (page_id = page_id , version_number = 1 )
1507
1507
page = self .get_page_by_id (page_id = page_id , expand = "version" )
1508
1508
page_number = page .get ("version" ).get ("number" )
1509
- log .info ("Removed oldest version for {} , now it's {}" . format ( page .get ("title" ), page_number ) )
1510
- log .info ("Kept versions {} for {}" . format ( keep_last_versions , page .get ("title" ) ))
1509
+ log .info ("Removed oldest version for %s , now it's %s" , page .get ("title" ), page_number )
1510
+ log .info ("Kept versions %s for %s" , keep_last_versions , page .get ("title" ))
1511
1511
1512
1512
def has_unknown_attachment_error (self , page_id ):
1513
1513
"""
@@ -1536,7 +1536,7 @@ def is_page_content_is_already_updated(self, page_id, body, title=None):
1536
1536
if title :
1537
1537
current_title = confluence_content .get ("title" , None )
1538
1538
if title != current_title :
1539
- log .info ("Title of {page_id} is different" . format ( page_id = page_id ) )
1539
+ log .info ("Title of %s is different" , page_id )
1540
1540
return False
1541
1541
1542
1542
if self .advanced_mode :
@@ -1554,14 +1554,14 @@ def is_page_content_is_already_updated(self, page_id, body, title=None):
1554
1554
# @todo move into utils
1555
1555
confluence_body_content = utils .symbol_normalizer (confluence_body_content )
1556
1556
1557
- log .debug ('Old Content: """{body} """' . format ( body = confluence_body_content ) )
1558
- log .debug ('New Content: """{body} """' . format ( body = body ) )
1557
+ log .debug ('Old Content: """%s """' , confluence_body_content )
1558
+ log .debug ('New Content: """%s """' , body )
1559
1559
1560
1560
if confluence_body_content .strip () == body .strip ():
1561
- log .info ("Content of {page_id} is exactly the same" . format ( page_id = page_id ) )
1561
+ log .info ("Content of %s is exactly the same" , page_id )
1562
1562
return True
1563
1563
else :
1564
- log .info ("Content of {page_id} differs" . format ( page_id = page_id ) )
1564
+ log .info ("Content of %s differs" , page_id )
1565
1565
return False
1566
1566
1567
1567
def update_existing_page (
@@ -1617,7 +1617,7 @@ def update_page(
1617
1617
"""
1618
1618
# update current page
1619
1619
params = {"status" : "current" }
1620
- log .info ('Updating {type} "{title} " with {parent_id}' . format ( title = title , type = type , parent_id = parent_id ) )
1620
+ log .info ('Updating %s "%s " with %s' , type , title , parent_id )
1621
1621
1622
1622
if not always_update and body is not None and self .is_page_content_is_already_updated (page_id , body , title ):
1623
1623
return self .get_page_by_id (page_id )
@@ -1628,7 +1628,7 @@ def update_page(
1628
1628
else :
1629
1629
version = self .history (page_id )["lastUpdated" ]["number" ] + 1
1630
1630
except (IndexError , TypeError ) as e :
1631
- log .error ("Can't find '{title}' {type}!" . format ( title = title , type = type ) )
1631
+ log .error ("Can't find '%s' %s!" , title , type )
1632
1632
log .debug (e )
1633
1633
return None
1634
1634
@@ -1699,7 +1699,7 @@ def _insert_to_existing_page(
1699
1699
:param top_of_page: Option to add the content to the end of page body
1700
1700
:return:
1701
1701
"""
1702
- log .info ('Updating {type} "{title}"' . format ( title = title , type = type ) )
1702
+ log .info ('Updating %s "%s"' , type , title )
1703
1703
# update current page
1704
1704
params = {"status" : "current" }
1705
1705
@@ -1768,7 +1768,7 @@ def append_page(
1768
1768
If False then notifications will be sent.
1769
1769
:return:
1770
1770
"""
1771
- log .info ('Updating {type} "{title}"' . format ( title = title , type = type ) )
1771
+ log .info ('Updating %s "%s"' , type , title )
1772
1772
1773
1773
return self ._insert_to_existing_page (
1774
1774
page_id ,
@@ -1803,7 +1803,7 @@ def prepend_page(
1803
1803
If False then notifications will be sent.
1804
1804
:return:
1805
1805
"""
1806
- log .info ('Updating {type} "{title}"' . format ( title = title , type = type ) )
1806
+ log .info ('Updating %s "%s"' , type , title )
1807
1807
1808
1808
return self ._insert_to_existing_page (
1809
1809
page_id ,
@@ -1866,10 +1866,9 @@ def update_or_create(
1866
1866
)
1867
1867
1868
1868
log .info (
1869
- "You may access your page at: {host}{url}" .format (
1870
- host = self .url ,
1871
- url = ((result or {}).get ("_links" ) or {}).get ("tinyui" ),
1872
- )
1869
+ "You may access your page at: %s%s" ,
1870
+ self .url ,
1871
+ ((result or {}).get ("_links" ) or {}).get ("tinyui" ),
1873
1872
)
1874
1873
return result
1875
1874
0 commit comments