Revision: 3941 Author: wikipedian Date: 2007-08-01 23:17:32 +0000 (Wed, 01 Aug 2007)
Log Message: ----------- fixed null pointer bug
Modified Paths: -------------- trunk/pywikipedia/weblinkchecker.py
Modified: trunk/pywikipedia/weblinkchecker.py =================================================================== --- trunk/pywikipedia/weblinkchecker.py 2007-08-01 23:10:15 UTC (rev 3940) +++ trunk/pywikipedia/weblinkchecker.py 2007-08-01 23:17:32 UTC (rev 3941) @@ -273,12 +273,11 @@ if response.status >= 300 and response.status <= 399: #print response.getheaders() redirTarget = response.getheader('Location') - try: - redirTarget.encode('ascii') - except UnicodeError: - redirTarget = unicode(redirTarget, self.getEncodingUsedByServer()) - #print "redirTarget:", redirTarget if redirTarget: + try: + redirTarget.encode('ascii') + except UnicodeError: + redirTarget = redirTarget.decode(self.getEncodingUsedByServer()) if redirTarget.startswith('http://') or redirTarget.startswith('https://'): self.changeUrl(redirTarget) return True
pywikipedia-l@lists.wikimedia.org