diff --git a/mwclient/RELEASE-NOTES.txt b/mwclient/RELEASE-NOTES.txt index 9b66adb5211e85ed9b2fc2c7a16b86380641c5ed..649101111cde764e21661fdc10cfcb0ef02687b0 100644 --- a/mwclient/RELEASE-NOTES.txt +++ b/mwclient/RELEASE-NOTES.txt @@ -3,7 +3,7 @@ RELEASE NOTES FOR MWCLIENT This is mwclient 0.6.6. The following are the release notes for this version. == Changes in version 0.6.6 == -No changes yet. +* Allow setting both the upload description and the page content separately == Changes in version 0.6.5 == * Explicitly convert the Content-Length header to str, avoiding a TypeError diff --git a/mwclient/client.py b/mwclient/client.py index 6dc7235e694e32a41f4389da7068a6d1f53e47eb..ccf17934b33558db077cd964c8f246d3ac8a27d3 100644 --- a/mwclient/client.py +++ b/mwclient/client.py @@ -353,7 +353,7 @@ class Site(object): def upload(self, file = None, filename = None, description = '', ignore = False, file_size = None, - url = None, session_key = None): + url = None, session_key = None, comment = None): """Upload a file to the wiki.""" if self.version[:2] < (1, 16): return compatibility.old_upload(self, file = file, filename = filename, @@ -368,7 +368,12 @@ class Site(object): predata = {} - predata['comment'] = description + if comment is None: + predata['comment'] = description + else: + predata['comment'] = comment + predata['text'] = description + if ignore: predata['ignorewarnings'] = 'true' predata['token'] = image.get_token('edit')