jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649642 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: I5532c848b239ce6c7dda2ecb46836195ca2fb128
---
M ROADMAP.rst
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index c701dca..5fec263 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,8 @@
Current release changes
~~~~~~~~~~~~~~~~~~~~~~~
+* wikistats methods fetch, raw_cached, csv, xml has been removed
+* PageRelatedError.getPage() has been removed in favour of PageRelatedError.page
* DataSite.get_item() method will be removed
* global put_throttle option may be given as float (T269741)
* Property.getType() method has been removed
@@ -18,8 +20,6 @@
~~~~~~~~~~~~~~~~~~~~
* 5.1.0: Positional arguments of page.Revision must be replaced by keyword arguments (T259428)
-* 5.0.0: wikistats methods fetch, raw_cached, csv, xml will be removed
-* 5.0.0: PageRelatedError.getPage() will be removes in favour of PageRelatedError.page
* 5.0.0: HttpRequest result of http.fetch() will be replaced by requests.Response (T265206)
* 5.0.0: OptionHandler.options dict will be removed in favour of OptionHandler.opt
* 5.0.0: Methods deprecated for 5 years or longer will be removed
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649642
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5532c848b239ce6c7dda2ecb46836195ca2fb128
Gerrit-Change-Number: 649642
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649024 )
Change subject: [IMPR] use response in http.error_handling_callback()
......................................................................
[IMPR] use response in http.error_handling_callback()
Remove some use of HttpRequest() inside http.py.
Bug: T265206
Change-Id: I5b62ff442a5df1d99bc2e656f74f9a67e25d7c6c
---
M pywikibot/comms/http.py
1 file changed, 21 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 1b97ee1..1fd2460 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -283,7 +283,7 @@
return None
-def error_handling_callback(request):
+def error_handling_callback(response):
"""
Raise exceptions and log alerts.
@@ -291,27 +291,30 @@
@type request: L{threadedhttp.HttpRequest}
"""
# TODO: do some error correcting stuff
- if isinstance(request.data, requests.exceptions.SSLError):
- if SSL_CERT_VERIFY_FAILED_MSG in str(request.data):
- raise FatalServerError(str(request.data))
+ if isinstance(response, requests.exceptions.SSLError):
+ if SSL_CERT_VERIFY_FAILED_MSG in str(response):
+ raise FatalServerError(str(response))
- if request.status_code == 504:
- raise Server504Error('Server {} timed out'
- .format(urlparse(request.url).netloc))
-
- if request.status_code == 414:
- raise Server414Error('Too long GET request')
-
- if isinstance(request.data, Exception):
+ if isinstance(response, Exception):
with suppress(Exception):
# request.data exception may contain response and request attribute
- error('An error occurred for uri ' + request.data.request.url)
- raise request.data from None
+ error('An error occurred for uri ' + response.request.url)
+ raise response from None
+
+ if response.status_code == 504:
+ raise Server504Error('Server {} timed out'
+ .format(urlparse(response.url).netloc))
+
+ if response.status_code == 414:
+ raise Server414Error('Too long GET request')
+
+ # TODO: shall it raise? this might break some code, TBC
+ # response.raise_for_status()
# HTTP status 207 is also a success status for Webdav FINDPROP,
# used by the version module.
- if request.status_code not in (200, 207):
- warning('Http response status {}'.format(request.status_code))
+ if response.status_code not in (200, 207):
+ warning('Http response status {}'.format(response.status_code))
@deprecate_arg('callback', True)
@@ -409,11 +412,12 @@
**kwargs)
except Exception as e:
request.data = e
+ response = e
else:
request.data = response
for callback in callbacks:
- callback(request)
+ callback(response)
# if there's no data in the answer we're in trouble
try:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649024
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5b62ff442a5df1d99bc2e656f74f9a67e25d7c6c
Gerrit-Change-Number: 649024
Gerrit-PatchSet: 3
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/647648 )
Change subject: [cleanup] remove deprecated template.XmlDumpTemplatePageGenerator
......................................................................
[cleanup] remove deprecated template.XmlDumpTemplatePageGenerator
Change-Id: I8954c3bbabfa65708db0c04ba1accd56321d86f2
---
M scripts/template.py
1 file changed, 1 insertion(+), 44 deletions(-)
Approvals:
D3r1ck01: Looks good to me, but someone else must approve
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/template.py b/scripts/template.py
index 8ba187f..e80c293 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -119,53 +119,10 @@
from pywikibot import i18n, pagegenerators, textlib
from pywikibot.bot import SingleSiteBot
from pywikibot.pagegenerators import XMLDumpPageGenerator
-from pywikibot.tools import deprecated, filter_unique
+from pywikibot.tools import filter_unique
from scripts.replace import ReplaceRobot as ReplaceBot
-@deprecated('XMLDumpPageGenerator', since='20151109', future_warning=True)
-class XmlDumpTemplatePageGenerator(XMLDumpPageGenerator):
-
- """
- Generator which yields Pages that transclude a template.
-
- These pages will be retrieved from a local XML dump file
- (cur table), and may not still transclude the template.
- """
-
- def __init__(self, templates, xmlfilename: str) -> None:
- """
- Initializer.
-
- @param templateNames: A list of Page objects representing the searched
- templates
- @type templateNames: list
- @param xmlfilename: The dump's path, either absolute or relative
-
- """
- self.templates = templates
- self.xmlfilename = xmlfilename
- mysite = pywikibot.Site()
- # regular expression to find the original template.
- # {{vfd}} does the same thing as {{Vfd}}, so both will be found.
- # The old syntax, {{msg:vfd}}, will also be found.
- template_patterns = []
- for template in self.templates:
- template_pattern = template.title(with_ns=False)
- if mysite.namespaces[10].case == 'first-letter':
- template_pattern = '[{0}{1}]{2}'.format(
- template_pattern[0].upper(), template_pattern[0].lower(),
- template_pattern[1:])
- template_pattern = re.sub(' ', '[_ ]', template_pattern)
- template_patterns.append(template_pattern)
- template_regex = re.compile(
- r'\{\{ *([mM][sS][gG]:)?(?:%s) *(?P<parameters>\|[^}]+|) *}}'
- % '|'.join(template_patterns))
-
- super().__init__(xmlfilename, site=mysite,
- text_predicate=template_regex.search)
-
-
class TemplateRobot(ReplaceBot):
"""This bot will replace, remove or subst all occurrences of a template."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/647648
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8954c3bbabfa65708db0c04ba1accd56321d86f2
Gerrit-Change-Number: 647648
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged