Skip to content
Snippets Groups Projects
Commit a6464a37 authored by Bryan Tong Minh's avatar Bryan Tong Minh
Browse files

* Allow arbitrary data to be passed to page.save

* Fix mwclient on WMF wikis
parent 53767dd5
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ This is mwclient 0.6.3. The following are the release notes for this version.
Mwclient 0.6.3 is unreleased.
* Added domain parameter to login.
* Applied edit fix to page_nowriteapi
* Allow arbitrary data to be passed to page.save
* Fix mwclient on WMF wikis
== Changes in version 0.6.2 ==
Mwclient was released on 2 May 2009.
......
......@@ -96,8 +96,11 @@ class Site(object):
if self.site['generator'].startswith('MediaWiki '):
version = self.site['generator'][10:].split('.')
# FIXME! Fix those awful two hacks
if len(version) == 2 and version[1].endswith('alpha'):
self.version = (int(version[0]), int(version[1][:-5]), 'alpha')
elif len(version) == 2 and version[1].endswith('alpha-wmf'):
self.version = (int(version[0]), int(version[1][:-5]), 'alpha-wmf')
elif len(version) == 3 and 'rc' in version[2]:
self.version = (int(version[0]), int(version[1]), version[2])
elif len(version) == 3:
......
......@@ -108,7 +108,7 @@ class Page(object):
self.edit_time = time.gmtime()
return self.text
def save(self, text = u'', summary = u'', minor = False, bot = True):
def save(self, text = u'', summary = u'', minor = False, bot = True, **kwargs):
if not self.site.logged_in and self.site.force_login:
# Should we really check for this?
raise errors.LoginError(self.site)
......@@ -129,6 +129,8 @@ class Page(object):
if self.edit_time: data['starttimestamp'] = time.strftime('%Y%m%d%H%M%S', self.edit_time)
if bot: data['bot'] = '1'
data.update(kwargs)
try:
result = self.site.api('edit', title = self.name, text = text,
summary = summary, token = self.get_token('edit'),
......@@ -143,6 +145,8 @@ class Page(object):
raise errors.ProtectedPageError(self, e.code, e.info)
else:
raise
if result['edit'] == 'Success':
self.last_rev_time = client.parse_timestamp(result['newtimestamp'])
return result['edit']
def get_expanded(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment