[Pywikipedia-l] SVN: [6241] trunk/pywikipedia/add_text.py

multichill at svn.wikimedia.org multichill at svn.wikimedia.org
Fri Jan 9 20:22:10 UTC 2009


Revision: 6241
Author:   multichill
Date:     2009-01-09 20:22:10 +0000 (Fri, 09 Jan 2009)

Log Message:
-----------
Or friends at nn got a message between the categories and the iw's and they want to keep it there.

Should be a better way to fix this, but this works.

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

Modified: trunk/pywikipedia/add_text.py
===================================================================
--- trunk/pywikipedia/add_text.py	2009-01-09 20:19:56 UTC (rev 6240)
+++ trunk/pywikipedia/add_text.py	2009-01-09 20:22:10 UTC (rev 6241)
@@ -67,6 +67,8 @@
     'zh': u'機器人: 正在新增 %s',
     }
 
+nn_iw_msg = u'<!--interwiki (no, sv, da first; then other languages alphabetically by name)-->'
+
 class NoEnoughData(wikipedia.Error):
     """ Error class for when the user doesn't specified all the data needed """
 
@@ -164,10 +166,16 @@
         interwikiInside = wikipedia.getLanguageLinks(newtext, site)
         # Removing the interwiki
         newtext = wikipedia.removeLanguageLinks(newtext, site)
+        #nn got a message between the categories and the iw's and they want to keep it there, first remove it
+        if (site.language()==u'nn'):
+            newtext = newtext.replace(nn_iw_msg, '')
         # Adding the text
         newtext += u"\n%s" % addText
         # Reputting the categories
         newtext = wikipedia.replaceCategoryLinks(newtext, categoriesInside, site, True)
+        #Put the nn iw message back
+        if (site.language()==u'nn'):
+            newtext = newtext + u'\n' + nn_iw_msg       
         # Dealing the stars' issue
         starsListInPage = list()
         for star in starsList:





More information about the Pywikipedia-l mailing list