Multichill added a comment.

FYI, on my not yet updated 6b8c01d, g7574, 2016/11/10, 09:32:07, n/a :

mdammers@bingo:~/pywikibot$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywikibot
>>> s = pywikibot.Site('en', 'wikipedia')
>>> r = s.data_repository()
>>> p = pywikibot.PropertyPage(r, 'P38')
>>> p.exists()
True
>>>

Maybe go back to my plan A?:

if not hasattr(self, '_content'):
    try:
        self.get()
        return True
     except pywikibot.IsRedirectPage
         return True
    except pywikibot.NoPage:
        return False
return 'lastrevid' in self._content

Yes, this will also return True if the redirect is to a deleted page, but that's quite an extreme edge case and if you follow a redirect you should do your checks again anyway for the target.

We should probably add tests to " TestPropertyPage" to test exists().


TASK DETAIL
https://phabricator.wikimedia.org/T145971

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt, Multichill
Cc: Magul, Pasleim, gerritbot, Xqt, Aklapper, TerraCodes, pywikibot-bugs-list, Multichill, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, MuhammadShuaib, jayvdb, Ricordisamoa, Wesalius, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to