http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9872
Revision: 9872 Author: binbot Date: 2012-02-07 13:19:24 +0000 (Tue, 07 Feb 2012) Log Message: ----------- Replaced firstcap() with builtin string method.
Modified Paths: -------------- trunk/pywikipedia/solve_disambiguation.py
Modified: trunk/pywikipedia/solve_disambiguation.py =================================================================== --- trunk/pywikipedia/solve_disambiguation.py 2012-02-06 15:28:06 UTC (rev 9871) +++ trunk/pywikipedia/solve_disambiguation.py 2012-02-07 13:19:24 UTC (rev 9872) @@ -73,7 +73,7 @@ # (C) Daniel Herding, 2004 # (C) Andre Engels, 2003-2004 # (C) WikiWichtel, 2004 -# (C) Pywikipedia team, 2003-2009 +# (C) Pywikipedia team, 2003-2012 # __version__='$Id$' # @@ -351,9 +351,6 @@ }, }
-def firstcap(string): - return string[0].upper()+string[1:] - def correctcap(link, text): # If text links to a page with title link uncapitalized, uncapitalize link, # otherwise capitalize it @@ -792,8 +789,8 @@ # check if we can create a link with trailing characters # instead of a pipelink elif len(new_page_title) <= len(link_text) \ - and firstcap(link_text[:len(new_page_title)]) \ - == firstcap(new_page_title) \ + and link_text[:len(new_page_title)].capitalize() \ + == new_page_title.capitalize() \ and re.sub(self.trailR, '', link_text[len(new_page_title):]) == '' \ and not section:
pywikipedia-svn@lists.wikimedia.org