Skip to content
Snippets Groups Projects
Commit ee30ef6c authored by Adam Williamson's avatar Adam Williamson Committed by Dan Michael O. Heggø
Browse files

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.
parent 2a42d77b
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
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