jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/409700 )
Change subject: config2.py: Handle PermissionError while creating user-config directory
......................................................................
config2.py: Handle PermissionError while creating user-config directory
There is no need to check for `os.path.isdir(dir)` condition. `os.makedirs`
will do that automatically and will raise `OSError` if `dir` exists.
Note that PermissionError is a subclass of OSError that does not exist in PY2.
Bug: T185082
Change-Id: Ifac3120b9deccb3d543fb9fc1f28ac6677dac252
---
M pywikibot/config2.py
1 file changed, 5 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index a575afc..1b42234 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -340,11 +340,12 @@
for dir in base_dir_cand:
dir = os.path.join(*dir)
- if not os.path.isdir(dir):
+ try:
os.makedirs(dir, mode=private_files_permission)
- if exists(dir):
- base_dir = dir
- break
+ except OSError: # PermissionError or already exists
+ if exists(dir):
+ base_dir = dir
+ break
if not os.path.isabs(base_dir):
base_dir = os.path.normpath(os.path.join(os.getcwd(), base_dir))
--
To view, visit https://gerrit.wikimedia.org/r/409700
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifac3120b9deccb3d543fb9fc1f28ac6677dac252
Gerrit-Change-Number: 409700
Gerrit-PatchSet: 3
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
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.
--
To view, visit https://gerrit.wikimedia.org/r/400236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I63e468f4b22714cf281755de90e8d9bf75647f7d
Gerrit-Change-Number: 400236
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Whym <whym(a)whym.org>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/409574 )
Change subject: doc/conf.py: Use the parent of the current file, not the parent of cwd
......................................................................
doc/conf.py: Use the parent of the current file, not the parent of cwd
'..' refers to the parent of current working directory. It may not work as
expected if the cwd is not `docs`.
Not sure, but this could be the cause of T185082.
Bug: T185082
Change-Id: I92dda3cc4f85215e1644ae473d0cd1853b6a26e9
---
M docs/conf.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 85380aa..41be174 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,12 +18,14 @@
from __future__ import absolute_import, unicode_literals
import os
+from os.path import abspath, dirname, join
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.insert(0, os.path.abspath('..'))
+repo_dir = abspath(join(dirname(__file__), '..'))
+sys.path.insert(0, repo_dir)
# -- General configuration -----------------------------------------------------
--
To view, visit https://gerrit.wikimedia.org/r/409574
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I92dda3cc4f85215e1644ae473d0cd1853b6a26e9
Gerrit-Change-Number: 409574
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>