http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10190
Revision: 10190 Author: xqt Date: 2012-05-06 06:20:55 +0000 (Sun, 06 May 2012) Log Message: ----------- update Page.site() to property Page.site from rewrite
Modified Paths: -------------- trunk/pywikipedia/interwiki_graph.py
Modified: trunk/pywikipedia/interwiki_graph.py =================================================================== --- trunk/pywikipedia/interwiki_graph.py 2012-05-05 21:29:41 UTC (rev 10189) +++ trunk/pywikipedia/interwiki_graph.py 2012-05-06 06:20:55 UTC (rev 10190) @@ -1,6 +1,6 @@ """ Module with the graphviz drawing calls """ # -# (C) Pywikipedia bot team, 2006-2010 +# (C) Pywikipedia bot team, 2006-2012 # # Distributed under the terms of the MIT license. # @@ -49,14 +49,14 @@ self.subject = subject
def getLabel(self, page): - return (u'"%s:%s"' % (page.site().language(), + return (u'"%s:%s"' % (page.site.language(), page.title())).encode('utf-8')
def addNode(self, page): node = pydot.Node(self.getLabel(page), shape = 'rectangle') node.set_URL(""http://%s%s%5C"" - % (page.site().hostname(), - page.site().get_address(page.urlname()))) + % (page.site.hostname(), + page.site.get_address(page.urlname()))) node.set_style('filled') node.set_fillcolor('white') node.set_fontsize('11') @@ -70,7 +70,7 @@ node.set_color('green') node.set_style('filled,bold') # if we found more than one valid page for this language: - if len(filter(lambda p: p.site() == page.site() and p.exists() \ + if len(filter(lambda p: p.site == page.site and p.exists() \ and not p.isRedirectPage(), self.subject.foundIn.keys())) > 1: # mark conflict by octagonal node @@ -102,7 +102,7 @@ # opposite edge. else: # add edge - if refPage.site() == page.site(): + if refPage.site == page.site: edge.set_color('blue') elif not page.exists(): # mark dead links @@ -141,8 +141,8 @@ self.saveGraphFile()
def getFilename(page, extension = None): - filename = '%s-%s-%s' % (page.site().family.name, - page.site().language(), + filename = '%s-%s-%s' % (page.site.family.name, + page.site.language(), page.titleForFilename()) if extension: filename += '.%s' % extension
pywikipedia-svn@lists.wikimedia.org