Revision: 3953 Author: valhallasw Date: 2007-08-02 15:18:17 +0000 (Thu, 02 Aug 2007)
Log Message: ----------- New version, now tests for <div id="mw-subcategories"> and, if not found, for <div id="mw-pages">. *** THIS MAY BREAK SUPPORT FOR OLDER VERSIONS OF MEDIAWIKI ***
Modified Paths: -------------- trunk/pywikipedia/catlib.py
Modified: trunk/pywikipedia/catlib.py =================================================================== --- trunk/pywikipedia/catlib.py 2007-08-02 15:07:16 UTC (rev 3952) +++ trunk/pywikipedia/catlib.py 2007-08-02 15:18:17 UTC (rev 3953) @@ -195,8 +195,14 @@ # save a copy of this text to find out self's supercategory. self_txt = txt # index where subcategory listing begins - # this only works for the current version of the MonoBook skin - ibegin = txt.index('Saved in parser cache') + try: + ibegin = txt.index('<div id="mw-subcategories">') + except ValueError: + try: + ibegin = txt.index('<div id="mw-pages">') + except ValueError: + wikipedia.output("\nCategory page detection is not bug free. Please report this error!") + raise # index where article listing ends try: iend = txt.index('<div class="printfooter">')