jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/400236 )
Change subject: [IMPR] Remove not implemented page and site methods ......................................................................
[IMPR] Remove not implemented page and site methods
- page.py: only show a warning when using removeImage or replaceImage which is the same behaviour as before this change
-site.py: remove depecated method which raised an NotImplementedError. This raises an AttributeError now which a bit different but it shouldn't care anyway,
Change-Id: I63e468f4b22714cf281755de90e8d9bf75647f7d --- M pywikibot/page.py M pywikibot/site.py 2 files changed, 8 insertions(+), 34 deletions(-)
Approvals: Framawiki: Looks good to me, but someone else must approve Whym: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 3511f43..5948519 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -2217,20 +2217,14 @@ restrictions = self.protection() return dict((k, list(restrictions[k])) for k in restrictions)
-# ###### DISABLED METHODS (warnings provided) ###### - # these methods are easily replaced by editing the page's text using - # textlib methods and then using put() on the result. - - def removeImage(self, image, put=False, summary=None, safe=True): - """Old method to remove all instances of an image from page.""" - warn('Page.removeImage() is no longer supported.', - _NotImplementedWarning, 2) - - def replaceImage(self, image, replacement=None, put=False, summary=None, - safe=True): - """Old method to replace all instances of an image with another.""" - warn('Page.replaceImage() is no longer supported.', - _NotImplementedWarning, 2) + def __getattr__(self, name): + """Generic disabled method warnings.""" + if name in ('removeImage', 'replaceImage'): + warn('Page.{0}() is no longer supported.'.format(name), + _NotImplementedWarning, 2) + return lambda x: None + raise AttributeError("'{0}' object has no attribute '{1}'" + .format(self.__class__.__name__, name))
class Page(BasePage): diff --git a/pywikibot/site.py b/pywikibot/site.py index 9794b6e..8e9f605 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -1286,26 +1286,6 @@ """DEPRECATED.""" return self.getUrl(address, data=data)
- @deprecated - def checkCharset(self, charset): - """DEPRECATED.""" - raise NotImplementedError - - @deprecated - def cookies(self, sysop=False): - """DEPRECATED.""" - raise NotImplementedError - - @deprecated - def updateCookies(self, datas, sysop=False): - """DEPRECATED.""" - raise NotImplementedError - - @deprecated - def solveCaptcha(self, data): - """DEPRECATED.""" - raise NotImplementedError -
def must_be(group=None, right=None): """Decorator to require a certain user status when method is called.
pywikibot-commits@lists.wikimedia.org