Revision: 4528
Author: rotem
Date: 2007-11-11 13:51:14 +0000 (Sun, 11 Nov 2007)
Log Message:
-----------
Fix a KeyError when searching Whatlinkshere, that next_text could be a div (if 'next
' is not a link); check if it has the href attribute before getting it.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-11-10 20:55:46 UTC (rev 4527)
+++ trunk/pywikipedia/wikipedia.py 2007-11-11 13:51:14 UTC (rev 4528)
@@ -1011,7 +1011,7 @@
convertEntities=BeautifulSoup.HTML_ENTITIES,
parseOnlyThese=content)
next_text = body.find(text=nextpattern)
- if next_text is not None:
+ if next_text is not None and next_text.has_key('href'):
path = next_text.parent['href'].replace("&",
"&")
else:
path = ""
Show replies by date