Revision: 4301 Author: cosoleto Date: 2007-09-15 19:36:09 +0000 (Sat, 15 Sep 2007)
Log Message: ----------- my previous commit is a mistake, sorry. Changed: "site.protocol" to "site.protocol()" in .permalink()
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-09-15 19:23:32 UTC (rev 4300) +++ trunk/pywikipedia/wikipedia.py 2007-09-15 19:36:09 UTC (rev 4301) @@ -644,8 +644,16 @@ self._startTime = m.group(1) else: self._startTime = "0" - - if len(text[i1:i2]) <= 1: + # Find out if page actually exists. Only existing pages have a + # version history tab. + if self.site().family.RversionTab(self.site().language()): + # In case a family does not have version history tabs, or in + # another form + RversionTab = re.compile(self.site().family.RversionTab(self.site().language())) + else: + RversionTab = re.compile(r'<li id="ca-history"><a href=".*?title=.*?&action=history".*?>.*?</a></li>') + matchVersionTab = RversionTab.search(text) + if not matchVersionTab: raise NoPage(self.site(), self.aslink(forceInterwiki = True)) # Look if the page is on our watchlist R = re.compile(r"<input tabindex='[\d]+' type='checkbox' name='wpWatchthis' checked='checked'") @@ -2194,6 +2202,8 @@ self.site = site self.pages = [] self.throttle = throttle + self.force = force + for pl in pages: if (not hasattr(pl,'_contents') and not hasattr(pl,'_getexception')) or force: self.pages.append(pl) @@ -2264,7 +2274,7 @@ page = Page(self.site, title) for page2 in self.pages: if page2.sectionFreeTitle() == page.sectionFreeTitle(): - if hasattr(page2,'_contents') or hasattr(page2,'_getexception'): + if (hasattr(page2,'_contents') or hasattr(page2,'_getexception')) and not self.force: return break else: @@ -4397,8 +4407,6 @@ output('Pywikipediabot %s' % (version.getversion())) output('Python %s' % (sys.version)) verbose += 1 - elif arg.startswith('-username'): - config.usernames[wikipedia.getSite().family.name][wikipedia.getSite().lang] = arg[9:] else: # the argument is not global. Let the specific bot script care # about it.