From ee30ef6c7fa7ea07510ca56efaed0b82557f2b10 Mon Sep 17 00:00:00 2001 From: Adam Williamson <awilliam@redhat.com> Date: Tue, 24 Mar 2015 20:50:01 -0700 Subject: [PATCH] Drop Page.section attribute This attribute goes back to an older design, where the 'edit page' workflow was different: the edit() method did part of the work of defining what text you meant to edit. In the current workflow, text() - which replaced the deprecated edit() - is only for retrieving text, and save() is supposed to do all the work of editing the page. The 'section' attribute is therefore obsolete and dangerous. --- mwclient/page.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/mwclient/page.py b/mwclient/page.py index c7d7c10..58cdabc 100644 --- a/mwclient/page.py +++ b/mwclient/page.py @@ -14,7 +14,6 @@ class Page(object): return self.__dict__.update(name.__dict__) self.site = site self.name = name - self.section = None if not info: if extra_properties: @@ -147,11 +146,9 @@ class Page(object): try: rev = revs.next() text = rev['*'] - self.section = section self.last_rev_time = rev['timestamp'] except StopIteration: text = u'' - self.section = None self.last_rev_time = None if not expandtemplates: self.edit_time = time.gmtime() @@ -172,14 +169,6 @@ class Page(object): if not self.can('edit'): raise mwclient.errors.ProtectedPageError(self) - if self.section is not None and section is None: - warnings.warn('From mwclient version 0.8.0, the `save()` method will no longer ' + - 'implicitly use the `section` parameter from the last `text()` or ' + - '`edit()` call. Please pass the `section` parameter explicitly to ' + - 'the save() method to save only a single section.', - category=DeprecationWarning, stacklevel=2) - section = self.section - if not self.site.writeapi: raise mwclient.errors.NoWriteApi(self) -- GitLab