jenkins-bot has submitted this change and it was merged.
Change subject: bugfixes and code improvements
......................................................................
bugfixes and code improvements
- remove settings hints which might be trivial
- remove global variable "always" and use a parameter
- remove wrong encoding from redirect target page object
- simplify inputChoise
- use page.text instead of page.get()
- use page.save() instead of page.put()
- remove unused "-start" option
- remove wrong encodings
- prohibit fallbacks
- exit the script if it is not localized
- rename page with image because it is an ImagePage
- recycle generator identifier
- highlight the image name when it is to be handled only and
show it only once
- use User class to get the talk page
Change-Id: I5ee94b0631067bf7c2b85fc3f305d840d6a260d0
---
M scripts/unusedfiles.py
1 file changed, 31 insertions(+), 42 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 86628f9..6ed936a 100644
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -23,12 +23,6 @@
import pywikibot
from pywikibot import pagegenerators
-# ***** SETTINGS *******#
-#
-# - EDIT BELOW - #
-#
-# **********************#
-
comment = {
'ar': u'صور للاستبعاد',
'en': u'images for elimination',
@@ -53,24 +47,17 @@
'it': u'<table id="mw_metadata" class="mw_metadata">',
}
-# ***** SETTINGS *******#
-#
-# - EDIT ABOVE - #
-#
-# **********************#
-
-def appendtext(page, apptext):
- global always
+def appendtext(page, apptext, always):
if page.isRedirectPage():
- page = page.getRedirectTarget().encode("utf-8")
+ page = page.getRedirectTarget()
if not page.exists():
if page.isTalkPage():
text = u''
else:
raise pywikibot.NoPage(u"Page '%s' does not exist" % page.title())
else:
- text = page.get()
+ text = page.text
# Here you can go editing. If you find you do not
# want to edit this page, just return
oldtext = text
@@ -80,49 +67,51 @@
if not always:
choice = pywikibot.inputChoice(
u'Do you want to accept these changes?', ['Yes', 'No', 'All'],
- ['y', 'N', 'a'], 'N')
+ 'yNa', 'N')
if choice == 'a':
always = True
if always or choice == 'y':
- page.put(text, pywikibot.translate(pywikibot.Site(), comment))
+ page.text = text
+ page.save(pywikibot.translate(pywikibot.Site(), comment))
def main():
- global always
always = False
for arg in pywikibot.handleArgs():
if arg == '-always':
always = True
- if arg == '-start':
- start = True
mysite = pywikibot.Site()
# If anything needs to be prepared, you can do it here
template_image = pywikibot.translate(pywikibot.Site(),
- template_to_the_image)
+ template_to_the_image, fallback=False)
template_user = pywikibot.translate(pywikibot.Site(),
- template_to_the_user).encode("utf-8")
- except_text_translated = pywikibot.translate(pywikibot.Site(),
- except_text).encode("utf-8")
- basicgenerator = pagegenerators.UnusedFilesGenerator()
- generator = pagegenerators.PreloadingGenerator(basicgenerator)
- for page in generator:
- pywikibot.output("\n\n>>> \03{lightpurple}%s\03{default} <<<"
- % page.title())
- if except_text_translated not in page.getImagePageHtml() and \
- 'http://' not in page.get():
- pywikibot.output(u'\n' + page.title())
- if template_image in page.get():
+ template_to_the_user, fallback=False)
+ except_text_translated = pywikibot.translate(pywikibot.Site(), except_text,
+ fallback=False)
+ if not(template_image and template_user and except_text_translated):
+ pywikibot.warning(u'This script is not localized for %s site.' % mysite)
+ return
+ generator = pagegenerators.UnusedFilesGenerator()
+ generator = pagegenerators.PreloadingGenerator(generator)
+ for image in generator:
+ if (except_text_translated.encode('utf-8')
+ not in image.getImagePageHtml() and
+ u'http://' not in image.text):
+ pywikibot.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<"
+ % image.title())
+ if template_image in image.text:
pywikibot.output(u"%s done already"
- % page.title(asLink=True))
+ % image.title(asLink=True))
continue
- appendtext(page, u"\n\n" + template_image)
- uploader = page.getFileVersionHistory().pop(0)['user']
- usertalkname = 'User Talk:%s' % uploader
- usertalkpage = pywikibot.Page(mysite, usertalkname)
- msg2uploader = template_user % {'title': page.title()}
- # msg2uploader = msg2uploader.encode("utf-8")
- appendtext(usertalkpage, msg2uploader)
+ appendtext(image, u"\n\n" + template_image, always)
+ uploader = image.getFileVersionHistory().pop(0)['user']
+ user = pywikibot.User(mysite, uploader)
+ usertalkpage = user.getUserTalkPage()
+ msg2uploader = template_user % {'title': image.title()}
+ appendtext(usertalkpage, msg2uploader, always)
+
+
if __name__ == "__main__":
main()
--
To view, visit https://gerrit.wikimedia.org/r/132342
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5ee94b0631067bf7c2b85fc3f305d840d6a260d0
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Strainu <wiki(a)strainu.ro>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Set config.use_mwparserfromhell to True by default
......................................................................
Set config.use_mwparserfromhell to True by default
I've been running with this for a while now, and haven't run
into any issues. It probably won't change anything for most users,
but for those with the library already installed, they'll see
a small performance boost.
Change-Id: Id088a84fa7d69053713cccb4c12995eaff3220ff
---
M pywikibot/config2.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
Ricordisamoa: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index d83009d..e1549d2 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -621,8 +621,9 @@
# Settings to enable mwparserfromhell
# <http://mwparserfromhell.readthedocs.org/en/latest/>
# Currently used in textlib.extract_templates_and_params
-# This should be more accurate than our current regex, but is currently opt-in.
-use_mwparserfromhell = False
+# This is more accurate than our current regex, but only works
+# if the user has already installed the library.
+use_mwparserfromhell = True
# End of configuration section
# ============================
--
To view, visit https://gerrit.wikimedia.org/r/131329
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id088a84fa7d69053713cccb4c12995eaff3220ff
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)live.it>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: using space character instead of tab character
......................................................................
using space character instead of tab character
see http://legacy.python.org/dev/peps/pep-0008/#tabs-or-spaces
Change-Id: If83d459e048a9582b343350833e95b3265275c33
---
M apispec.py
M tests/test_ipregex.py
2 files changed, 21 insertions(+), 21 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/apispec.py b/apispec.py
index f2d599b..9f589c7 100644
--- a/apispec.py
+++ b/apispec.py
@@ -118,19 +118,19 @@
rangeblocks List of range blocks
reguserblocks List of blocks concerning registered users, not anons
byadmin Blocks raised by a given admin
- user Blocks of the given user or single IP (exact match)
+ user Blocks of the given user or single IP (exact match)
(Only direct blocks for the given IP, not range blocks)
- userfragment Blocks of the given user or single IP
+ userfragment Blocks of the given user or single IP
You may give any part of the username.
- userregex Blocks of the given user or single IP
+ userregex Blocks of the given user or single IP
Give a regex with r'...' or ur'...'
- IP Blocks of the given single IP or range (max. /16)
+ IP Blocks of the given single IP or range (max. /16)
If you give an IP, this will return also range blocks
concerning this IP (not like user()).
- reason Blocks raised with the given reason (exact match)
- reasonfragment Blocks raised with the given reason
+ reason Blocks raised with the given reason (exact match)
+ reasonfragment Blocks raised with the given reason
You may give any part of the reason, e.g. 'andalism'
- reasonregex Blocks raised with the given reason (regex)
+ reasonregex Blocks raised with the given reason (regex)
Remarks: user-like and reason-like methods are case sensitive.
Use user() and IP() whenever appropriate. They are much faster
and cause less server load!
diff --git a/tests/test_ipregex.py b/tests/test_ipregex.py
index 1c7cacc..cca6feb 100644
--- a/tests/test_ipregex.py
+++ b/tests/test_ipregex.py
@@ -49,18 +49,18 @@
self.ipv6test(1, "FF02:0000:0000:0000:0000:0000:0000:0001");
self.ipv6test(1, "0000:0000:0000:0000:0000:0000:0000:0001");
self.ipv6test(1, "0000:0000:0000:0000:0000:0000:0000:0000");
- self.ipv6test(not 1, "02001:0000:1234:0000:0000:C1C0:ABCD:0876"); # extra 0 not allowed!
- self.ipv6test(not 1, "2001:0000:1234:0000:00001:C1C0:ABCD:0876"); # extra 0 not allowed!
- #self.ipv6test(1, " 2001:0000:1234:0000:0000:C1C0:ABCD:0876"); # leading space
- #self.ipv6test(1, "2001:0000:1234:0000:0000:C1C0:ABCD:0876"); # trailing space
- #self.ipv6test(1, " 2001:0000:1234:0000:0000:C1C0:ABCD:0876 "); # leading and trailing space
- self.ipv6test(not 1, "2001:0000:1234:0000:0000:C1C0:ABCD:0876 0"); # junk after valid address
- self.ipv6test(not 1, "2001:0000:1234: 0000:0000:C1C0:ABCD:0876"); # internal space
+ self.ipv6test(not 1, "02001:0000:1234:0000:0000:C1C0:ABCD:0876"); # extra 0 not allowed!
+ self.ipv6test(not 1, "2001:0000:1234:0000:00001:C1C0:ABCD:0876"); # extra 0 not allowed!
+ #self.ipv6test(1, " 2001:0000:1234:0000:0000:C1C0:ABCD:0876"); # leading space
+ #self.ipv6test(1, "2001:0000:1234:0000:0000:C1C0:ABCD:0876"); # trailing space
+ #self.ipv6test(1, " 2001:0000:1234:0000:0000:C1C0:ABCD:0876 "); # leading and trailing space
+ self.ipv6test(not 1, "2001:0000:1234:0000:0000:C1C0:ABCD:0876 0"); # junk after valid address
+ self.ipv6test(not 1, "2001:0000:1234: 0000:0000:C1C0:ABCD:0876"); # internal space
- self.ipv6test(not 1, "3ffe:0b00:0000:0001:0000:0000:000a"); # seven segments
- self.ipv6test(not 1, "FF02:0000:0000:0000:0000:0000:0000:0000:0001"); # nine segments
- self.ipv6test(not 1, "3ffe:b00::1::a"); # double "::"
- self.ipv6test(not 1, "::1111:2222:3333:4444:5555:6666::"); # double "::"
+ self.ipv6test(not 1, "3ffe:0b00:0000:0001:0000:0000:000a"); # seven segments
+ self.ipv6test(not 1, "FF02:0000:0000:0000:0000:0000:0000:0000:0001"); # nine segments
+ self.ipv6test(not 1, "3ffe:b00::1::a"); # double "::"
+ self.ipv6test(not 1, "::1111:2222:3333:4444:5555:6666::"); # double "::"
self.ipv6test(1, "2::10");
self.ipv6test(1, "ff02::1");
self.ipv6test(1, "fe80::");
@@ -96,7 +96,7 @@
self.ipv6test(1, "1:2::");
self.ipv6test(1, "1::");
self.ipv6test(1, "1:2:3:4:5::7:8");
- self.ipv6test(not 1, "1:2:3::4:5::7:8"); # Double "::"
+ self.ipv6test(not 1, "1:2:3::4:5::7:8"); # Double "::"
self.ipv6test(not 1, "12345::6:7:8");
self.ipv6test(1, "1:2:3:4::7:8");
self.ipv6test(1, "1:2:3::7:8");
@@ -165,8 +165,8 @@
self.ipv6test(not 1, "::3000.30.30.30");
self.ipv6test(1, "fe80::217:f2ff:254.7.237.98");
self.ipv6test(1, "::ffff:192.168.1.26");
- self.ipv6test(not 1, "2001:1:1:1:1:1:255Z255X255Y255"); # garbage instead of "." in IPv4
- self.ipv6test(not 1, "::ffff:192x168.1.26"); # ditto
+ self.ipv6test(not 1, "2001:1:1:1:1:1:255Z255X255Y255"); # garbage instead of "." in IPv4
+ self.ipv6test(not 1, "::ffff:192x168.1.26"); # ditto
self.ipv6test(1, "::ffff:192.168.1.1");
self.ipv6test(1, "0:0:0:0:0:0:13.1.68.3");# IPv4-compatible IPv6 address, full, deprecated
self.ipv6test(1, "0:0:0:0:0:FFFF:129.144.52.38");# IPv4-mapped IPv6 address, full
--
To view, visit https://gerrit.wikimedia.org/r/132742
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If83d459e048a9582b343350833e95b3265275c33
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: (bugfix) Test whether a method is supported by mediawiki version
......................................................................
(bugfix) Test whether a method is supported by mediawiki version
The given assert in some generators does not work because
Site.versionnumber is a function, not an attribute holding the
value.
The assert function is replaced by the decorator "need_version"
to require a certain mediawiki version number.
Change-Id: I40460e83189954a7b2d0b37e5198084993d1a5a4
---
M pywikibot/site.py
1 file changed, 24 insertions(+), 3 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index bbacf31..7b00999 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -723,6 +723,27 @@
return decorator
+def need_version(number):
+ """ Decorator to require a certain mediawiki version number.
+
+ @param number: the mw version number required
+ @return: a decorator to make sure the requirement is statisfied when
+ the decorated function is called.
+ """
+ def decorator(fn):
+ def callee(self, *args, **kwargs):
+ if self.versionnumber() < number:
+ raise NotImplementedError(
+ u'Method or function "%s"\n'
+ u"isn't implemented in mediawiki version < %d"
+ % (fn.__name__, number))
+ return fn(self, *args, **kwargs)
+ callee.__name__ = fn.__name__
+ callee.__doc__ = fn.__doc__
+ return callee
+ return decorator
+
+
class APISite(BaseSite):
"""API interface to MediaWiki site.
@@ -3593,27 +3614,27 @@
step=step, total=total)
return wigen
+ @need_version(18)
def broken_redirects(self, step=None, total=None):
"""Yield Pages without language links from Special:BrokenRedirects."""
- assert self.versionnumber >= 18
brgen = self._generator(api.PageGenerator,
type_arg="querypage",
gqppage="BrokenRedirects",
step=step, total=total)
return brgen
+ @need_version(18)
def double_redirects(self, step=None, total=None):
"""Yield Pages without language links from Special:BrokenRedirects."""
- assert self.versionnumber >= 18
drgen = self._generator(api.PageGenerator,
type_arg="querypage",
gqppage="DoubleRedirects",
step=step, total=total)
return drgen
+ @need_version(18)
def redirectpages(self, step=None, total=None):
"""Yield redirect pages from Special:ListRedirects."""
- assert self.versionnumber >= 18
lrgen = self._generator(api.PageGenerator,
type_arg="querypage",
gqppage="Listredirects",
--
To view, visit https://gerrit.wikimedia.org/r/129955
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I40460e83189954a7b2d0b37e5198084993d1a5a4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Add proper package specification for PyPI
......................................................................
Add proper package specification for PyPI
PyPI likes rst files, so move from .md -> .rst. This
should not matter for GitHub.
Otherwise mainly small tweaks to make sure the PyPI listing
refers to the GitHub master zip.
Change-Id: I40252d3cadc7d13dd8d98db8684bb784185f1fdf
---
D README.md
A README.rst
M setup.py
3 files changed, 52 insertions(+), 36 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README.md b/README.md
deleted file mode 100644
index 06aed08..0000000
--- a/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Pywikibot Framework
-
-[![Build Status](https://secure.travis-ci.org/wikimedia/pywikibot-core.png?branch=ma…
-
-The pywikibot framework is a Python library that interfaces with the [MediaWiki API](https://www.mediawiki.org/wiki/API).
-Also included are various general function scripts that can be adapted for different tasks.
-
-## Quick start
-```
-git clone https://gerrit.wikimedia.org/r/pywikibot/core.git
-cd core
-git submodule update --init
-python pwb.py script_name
-```
-
-Our [installation guide](https://www.mediawiki.org/wiki/Manual:Pywikipediabot/Installation) has more details for advanced usage.
-
-## Usage
-
-If you wish to write your own script it's very easy to get started:
-
-```python
-import pywikibot
-site = pywikibot.Site('en', 'wikipedia') # The site we want to run our bot on
-page = pywikibot.Page(site, 'Wikipedia:Sandbox')
-text = page.text # The current text on the page
-page.text = text.replace('foo', 'bar')
-page.save('Replacing "foo" with "bar"') # Saves the page
-```
-
-## Contributing
-
-Our code is maintained on Wikimedia's [Gerrit installation](https://gerrit.wikimedia.org/), [learn](https://www.mediawiki.org/wiki/Developer_access) how to get started.
-
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..e19cdc5
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,45 @@
+Pywikibot Framework
+===================
+
+The pywikibot framework is a Python library that interfaces with the
+`MediaWiki API <https://www.mediawiki.org/wiki/API>`_. Also included are
+various general function scripts that can be adapted for different
+tasks.
+
+Quick start
+-----------
+
+::
+
+ git clone https://gerrit.wikimedia.org/r/pywikibot/core.git
+ cd core
+ git submodule update --init
+ python pwb.py script_name
+
+Our `installation
+guide <https://www.mediawiki.org/wiki/Manual:Pywikipediabot/Installation>`_
+has more details for advanced usage.
+
+Usage
+-----
+
+If you wish to write your own script it's very easy to get started:
+
+::
+
+ import pywikibot
+ site = pywikibot.Site('en', 'wikipedia') # The site we want to run our bot on
+ page = pywikibot.Page(site, 'Wikipedia:Sandbox')
+ page.text = page.text.replace('foo', 'bar')
+ page.save('Replacing "foo" with "bar"') # Saves the page
+
+Contributing
+------------
+
+Our code is maintained on Wikimedia's `Gerrit installation <https://gerrit.wikimedia.org/>`_,
+`learn <https://www.mediawiki.org/wiki/Developer_access>`_ how to get
+started.
+
+.. image:: https://secure.travis-ci.org/wikimedia/pywikibot-core.png?branch=master
+ :alt: Build Status
+ :target: http://travis-ci.org/wikimedia/pywikibot-core
diff --git a/setup.py b/setup.py
index cf14a97..399af0c 100644
--- a/setup.py
+++ b/setup.py
@@ -54,9 +54,12 @@
subprocess.call([python, "generate_user_files.py"])
setup(
- name='Pywikipediabot',
+ name='pywikibot',
version='2.0b1',
description='Python Wikipedia Bot Framework',
+ long_description=open('README.rst').read(),
+ maintainer='The pywikibot team',
+ maintainer_email='pywikipedia-l(a)lists.wikimedia.org',
license='MIT License',
packages=['pywikibot'] + \
[package
@@ -69,11 +72,13 @@
dependency_links=[
'https://git.wikimedia.org/zip/?r=pywikibot/externals/httplib2.git&format=gz…'
],
+ url='https://mediawiki.org/wiki/Pywikibot',
+ download_url='https://github.com/wikimedia/pywikibot-core/archive/master.zip#egg=pywikibo…',
test_suite=testcollector,
tests_require=test_deps,
classifiers=[
'License :: OSI Approved :: MIT License',
- 'Development Status :: 4 - Beta'
+ 'Development Status :: 4 - Beta',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Environment :: Console',
--
To view, visit https://gerrit.wikimedia.org/r/132712
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I40252d3cadc7d13dd8d98db8684bb784185f1fdf
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Bug 65145: do not run generate_user_files if stdout is a pipe
......................................................................
Bug 65145: do not run generate_user_files if stdout is a pipe
pip will run generate_user_files with stdout directed to a log
file, but stdin as a terminal. As such, GUF will wait for user
input, but the user has no idea they should input anything.
This change prevents that.
Change-Id: Iaa596bf40e4d49c73b9a73ee6423c3a6b6899449
---
M setup.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index 580f9b1..2b7e22f 100644
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,7 @@
def run(self):
install.install.do_egg_install(self)
- if sys.stdin.isatty():
+ if sys.stdin.isatty() and sys.stdout.isatty():
import subprocess
python = sys.executable
python = python.replace("pythonw.exe", "python.exe") # for Windows
--
To view, visit https://gerrit.wikimedia.org/r/132713
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa596bf40e4d49c73b9a73ee6423c3a6b6899449
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: use the core method page.text and page.save() for the sample
......................................................................
use the core method page.text and page.save() for the sample
core introduces the page.text getter/setter method instead of
page.get() and page.put(). We should provide it in this sample.
Change-Id: I25e039839a4661577f9bcd817d1618cdbab69bd4
---
M README.md
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README.md b/README.md
index 7acbc43..06aed08 100644
--- a/README.md
+++ b/README.md
@@ -23,9 +23,9 @@
import pywikibot
site = pywikibot.Site('en', 'wikipedia') # The site we want to run our bot on
page = pywikibot.Page(site, 'Wikipedia:Sandbox')
-text = page.get() # The current text on the page
-text = text.replace('foo', 'bar')
-page.put(text, 'Replacing "foo" with "bar"') # Saves the page
+text = page.text # The current text on the page
+page.text = text.replace('foo', 'bar')
+page.save('Replacing "foo" with "bar"') # Saves the page
```
## Contributing
--
To view, visit https://gerrit.wikimedia.org/r/132597
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I25e039839a4661577f9bcd817d1618cdbab69bd4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>