From 4d8abc405ec5f85473088162452a7f8050f7ff74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Sat, 18 Jul 2015 20:43:39 +0200
Subject: [PATCH] Deprecate implicit use of Page.section when saving

- Add a warning to prepare for the merge of #81
- Update existing deprecation warnings
---
 mwclient/page.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mwclient/page.py b/mwclient/page.py
index 9d70b6c..c0c3aec 100644
--- a/mwclient/page.py
+++ b/mwclient/page.py
@@ -109,14 +109,14 @@ class Page(object):
 
     def get_expanded(self):
         """Deprecated. Use page.text(expandtemplates=True) instead"""
-        warnings.warn("page.get_expanded() was deprecated in mwclient 0.7.0, use page.text(expandtemplates=True) instead.",
+        warnings.warn("page.get_expanded() was deprecated in mwclient 0.7.0 and will be removed in 0.8.0, use page.text(expandtemplates=True) instead.",
                       category=DeprecationWarning, stacklevel=2)
 
         return self.text(expandtemplates=True)
 
     def edit(self, *args, **kwargs):
         """Deprecated. Use page.text() instead"""
-        warnings.warn("page.edit() was deprecated in mwclient 0.7.0, please use page.text() instead.",
+        warnings.warn("page.edit() was deprecated in mwclient 0.7.0 and will be removed in 0.8.0, please use page.text() instead.",
                       category=DeprecationWarning, stacklevel=2)
         return self.text(*args, **kwargs)
 
@@ -165,7 +165,12 @@ class Page(object):
         if not self.can('edit'):
             raise errors.ProtectedPageError(self)
 
-        if not section:
+        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:
-- 
GitLab