APISite.siteinfo automatically fetches the results

This changes it from a dict to a Wrapper which automatically
queries the result if they aren't cached. It is basically merging
APISite._add_siteinfo, APISite._getsiteinfo and APISite.siteinfo.

It'll always caches the result of the siprop "general", because
otherwise it would be unable to determine if a requested property
is in fact a property of "general" (e.g. APISite.case()).

It also supports the "in" operator which tells you if the value is
cached. Setting it from the outside is not possible anymore.

If a property isn't supported (e.g. 'restrictions' before 1.23) it
will cache either an empty dummy object (which acts like an empty
string/iterable/dict) or a specific default constant.

Change-Id: Ib5b6d84f0baf60376cdc25bc715d346c1579da1f
Merge "APISite.siteinfo automatically fetches the results"
rename ImagePage to FilePage

for consistency with the MediaWiki canonical namespace name;
also, ImagePage did not actually expose any methods peculiar to images

- replaced all occurrences
- added a notice to README-conversion.txt
- updated compat2core.py to make replacements easier

Change-Id: I289da42fa4b5f78e4837c8e4c1a3a72e9d322990
Merge "Ensure genFactory.namespaces is always ints"
Merge "Allow sleeps to occur during scripts"
standardize redirect.py

RedirectRobot extends pywikibot.Bot (with built-in 'always' option)

Change-Id: I9cf373e211226b57edad36276d3376f99a3b6b98
The Final Flakes

hashar has enabled the flake8 tests on jenkins to be voting,
so new flakes will be hard to push into the codebase in future.

This changeset removes two that have slipped into the codebase
over the last week.

setup.py:37:9: F401 'unittest' imported but unused
scripts/protect.py:222:41: F812 list comprehension redefines 'p_type'
from line 189

Change-Id: I19fb7ca525383ef1ab13e807edc9b4b00394cbb1
PropertyPage.get() fails

PropertyPage method get attempts to set 'type', which is a
property of superclass Property that does not have a setter, resulting
in an AttributeError:

    self.type = self._content['datatype']
AttributeError: can't set attribute

Fix by putting the datatype into the underlying _type attribute.

Also use the 'type' property in PropertyPage.newClaim so that each newly
created Claim does not need to fetch the property type.

Change-Id: I845ec3ad91017e386e568ee5bcb85fd48644adfb
Split getversion_svn into two utility functions

Change-Id: Ifde44b119a5429b81a9eb7643c1c94dbfdbeaa09
Email and IRC build notifications

Always send build notifications to pywikibot-commits@lists.wikimedia.org
as even successes may have slightly different output, and the build
email signals that the build is completed.

Only notify IRC on changes, and reduce the IRC build notice to one
message which will wrap onto two lines.

Change-Id: I5cc6e11e6bf5ecb2da83f9b1c4d5c40ea9caa694
flickrripper.py: Protect the import of flickrapi with a try block.

Bug: 68606
Change-Id: Iba332b3462eb7e188df4ae049db59d946b0aa92e
APISite: factor out validation of iterations params

A few methods in APISite were reusing the exact same code to validate
parameters used with an iterator (start, end, reverse).  The new
assert_valid_iter_params() now takes care of it.

Change-Id: I3e90ec613080c5257ce1ed1ebbd981841f0a192e
use need_version decorator for hasExtension method

Change-Id: I62d6a832c23d1cece6e16491fe44b613693ada76
Merge "flickrripper.py: Protect the import of flickrapi with a try block."
Category.py script handles empty and redirect pages

This patch fixes three problems: First if the to-be-edited page is empty
it was skipped even when "-create" is set, because the actual content
("", an empty string) was never returned. The same problem was there
when the to-be-edited page is a redirect, but that doesn't fix all
problems there.

The second part only affects adding categories to redirect targets.
If the same fix is applied that "-redirect" actually returns the
target contents it still crash because it's unable to save the page.
This is due to the fact that it only checks if the currently edited
page is a redirect when it's loading the content but nowhere else.
The fix there is simply to change the Page instance from the redirect
page to the redirect target page (if "-redirect" is given) and skip it
otherwise.

And lastly when creating a page, it can't of course get the text
afterwards to show the difference. So the third part of that changeset
is using the cached content from the beginning to show the difference.

Bug: 69185
Bug: 69186
Change-Id: I4bfd4db128e8398df43f847cc3cbd8143088686d
Merge "Category.py script handles empty and redirect pages"
Don't aggressively cache token requests in tests

Tests aggressively cache all API responses, with the
exception of requests containing 'lgpassword'.

Announced recently, token handling on the server is changing.
Brad Jorsch: 'Upcoming changes to token handling'
https://lists.wikimedia.org/pipermail/mediawiki-api-announce/2014-August/000063.html

pywikibot doesnt handle 'badtoken', which should cause the client to
get a new token.

As a result, re-running tests now fail with badtoken errors, and
can only be corrected by deleting the data in tests/apicache.

This patch tells the test layer to not use the API cache for
any request containing 'intoken', so new tokens will be requested
each test run.

Change-Id: I9f7d86bd1a13eda3cc0b2170840c9d65e716dd20
Remove every implicit use of textlib

follows:
* Iabede1697aa1f5c8e3039b2b404029bc6cfd55ff
* I6cc16f23fe9fbb851b26725557525619c3051a26

Change-Id: I0437028a32da219205fc30aec3921474132e1cc8
Merge "use need_version decorator for hasExtension method"
Fix backwards compatibility of APISite.hasExtension()

Previously that method used "name" and "unknown", but "unknown" was
removed in d42d519adf59b92998ba7b87008c58b7193a7014 so tests broke
which used it as a positional parameter.

This adds a method has_extension which only accepts one parameter
while the old hasExtension supports both (but ignores the second
completely).

This also fixes the site tests which may relied on it so various
tests aren't applicable anymore. There is only one test which makes
sense but is deactived, because it won't work unless it is possible
to make "need_version" believe that the current version doesn't
support it.

Change-Id: I22a17b0f9eca208daaa3b3eeeab1b86b5c34b399