[Pywikipedia-l] SVN: [4916] trunk/pywikipedia/wikipedia.py

russblau at svn.wikimedia.org russblau at svn.wikimedia.org
Fri Jan 18 21:03:55 UTC 2008


Revision: 4916
Author:   russblau
Date:     2008-01-18 21:03:55 +0000 (Fri, 18 Jan 2008)

Log Message:
-----------
Fix Page.aslink() to avoid [[commons:commons:Title]] type links.

Modified Paths:
--------------
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-01-18 21:00:27 UTC (rev 4915)
+++ trunk/pywikipedia/wikipedia.py	2008-01-18 21:03:55 UTC (rev 4916)
@@ -506,10 +506,14 @@
         
         """
         if not noInterwiki and (forceInterwiki or self.site() != getSite()):
-            if self.site().family != getSite().family:
-                return u'[[%s:%s:%s]]' % (self.site().family.name, self.site().lang, self.title(savetitle=True))
+            if self.site().family != getSite().family \
+                    and self.site().family.name != self.site().lang:
+                return u'[[%s:%s:%s]]' % (self.site().family.name,
+                                          self.site().lang,
+                                          self.title(savetitle=True))
             else:
-                return u'[[%s:%s]]' % (self.site().lang, self.title(savetitle=True))
+                return u'[[%s:%s]]' % (self.site().lang,
+                                       self.title(savetitle=True))
         elif textlink and (self.isImage() or self.isCategory()):
                 return u'[[:%s]]' % self.title()
         else:





More information about the Pywikipedia-l mailing list