Multichill created this task. Multichill added projects: Pywikibot-core, Easy, Pywikibot-Wikidata. Herald added subscribers: pywikibot-bugs-list, TerraCodes, Aklapper. |
TASK DESCRIPTION
The normal exists() is defined as:
def exists(self): """Return True if page exists on the wiki, even if it's a redirect.
If the title includes a section, return False if this section isn't found. @rtype: bool """ return self.site.page_exists(self)
In ItemPage.exists() the code is this:
def exists(self): """ Determine if an entity exists in the data repository. @rtype: bool """ if not hasattr(self, '_content'): try: self.get() return True except pywikibot.NoPage: return False return 'lastrevid' in self._content
So if you do this on an existing item that is a redirect you'll get a nice exception. Probably easiest to just update it like this:
except pywikibot.IsRedirectPage return True
Some tests would be nice to verify this keeps working.
TASK DETAIL
EMAIL PREFERENCES
To: Multichill
Cc: Aklapper, TerraCodes, pywikibot-bugs-list, Multichill, MayS, Esc3300, Mdupont, JJMC89, MuhammadShuaib, jayvdb, Ricordisamoa, Alchimista
Cc: Aklapper, TerraCodes, pywikibot-bugs-list, Multichill, MayS, Esc3300, Mdupont, JJMC89, MuhammadShuaib, jayvdb, Ricordisamoa, Alchimista
_______________________________________________ pywikibot-bugs mailing list pywikibot-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs