[Pywikipedia-l] SVN: [6266] trunk/pywikipedia

russblau at svn.wikimedia.org russblau at svn.wikimedia.org
Sun Jan 18 22:23:28 UTC 2009


Revision: 6266
Author:   russblau
Date:     2009-01-18 22:23:28 +0000 (Sun, 18 Jan 2009)

Log Message:
-----------
Add redirect templates to category redirect list

Modified Paths:
--------------
    trunk/pywikipedia/families/commons_family.py
    trunk/pywikipedia/families/wikipedia_family.py
    trunk/pywikipedia/family.py
    trunk/pywikipedia/redirect.py
    trunk/pywikipedia/wikipedia.py
    trunk/pywikipedia/xmlreader.py

Modified: trunk/pywikipedia/families/commons_family.py
===================================================================
--- trunk/pywikipedia/families/commons_family.py	2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/families/commons_family.py	2009-01-18 22:23:28 UTC (rev 6266)
@@ -30,7 +30,16 @@
         self.interwiki_forward = 'wikipedia'
 
         self.category_redirect_templates = {
-            'commons': ('Category redirect',),
+            'commons': (u'Category redirect',
+                        u'Categoryredirect',
+                        u'See cat',
+                        u'Seecat',
+                        u'Catredirect',
+                        u'Cat redirect',
+                        u'CatRed',
+                        u'Cat-red',
+                        u'Catredir',
+                        u'Redirect category'),
         }
         
         self.disambiguationTemplates = {

Modified: trunk/pywikipedia/families/wikipedia_family.py
===================================================================
--- trunk/pywikipedia/families/wikipedia_family.py	2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/families/wikipedia_family.py	2009-01-18 22:23:28 UTC (rev 6266)
@@ -542,44 +542,78 @@
 
         self.category_redirect_templates = {
             '_default': (),
-            'ar': (u"تحويل تصنيف",),
+            'ar': (u"تحويل تصنيف",
+                   u"تحويلة تصنيف",
+                   u"Category redirect",
+                   u"تحويلة تصنيف",),
             'arz': (u'تحويل تصنيف',),
             'cs': (u'Zastaralá kategorie',),
             'da': (u'Kategoriomdirigering',),
             'de': (u'Kategorieweiterleitung',),
             'en': (u"Category redirect",
                    u"Category redirect3",
-                  ),
+                   u"Categoryredirect",
+                   u"CR",
+                   u"Catredirect",
+                   u"Cat redirect",
+                   u"Seecat",),
             'es': (u'Categoría redirigida',),
             'eu': (u'Kategoria redirect',),
             'fa': (u'رده بهتر',
                    u'انتقال رده',
-                   u'فیلم‌های امریکایی'),
+                   u'فیلم‌های امریکایی',),
             'fr': (u'Redirection de catégorie',),
-            'hi': (u'श्रेणीअनुप्रेषित',),
-            'id': (u'Alih kategori',),
+            'hi': (u'श्रेणीअनुप्रेषित',
+                   u'Categoryredirect',),
+            'id': (u'Alih kategori',
+                   u'Alihkategori',),
             # 'it' has removed its template
             # 'ja' is discussing to remove this template
             'ja': (u"Category redirect",),
             'ko': (u'분류 넘겨주기',),
             'mk': (u'Премести категорија',),
-            'ms': (u'Pengalihan kategori',),
+            'ms': (u'Pengalihan kategori',
+                   u'Categoryredirect',
+                   u'Category redirect',),
             'mt': (u'Redirect kategorija',),
             # 'nl' has removed its template
-            'no': (u"Kategoriomdirigering",),
-            'pl': (u'Przekierowanie kategorii',),
-            'pt': (u'Redirecionamento de categoria',),
+            'no': (u"Category redirect",
+                   u"Kategoriomdirigering",
+                   u"Kategori-omdirigering",),
+            'pl': (u'Przekierowanie kategorii',
+                   u'Category redirect',),
+            'pt': (u'Redirecionamento de categoria',
+                   u'Redircat',
+                   u'Redirect-categoria',),
             'ro': (u'Redirect categorie',),
-            'ru': (u'Переименованная категория',),
-            'simple': (u"Category redirect",),
-            'sq': (u'Kategori e zhvendosur',),
+            'ru': (u'Переименованная категория',
+                   u'Categoryredirect',
+                   u'CategoryRedirect',
+                   u'Category redirect',
+                   u'Catredirect',),
+            'simple': (u"Category redirect",
+                       u"Catredirect",),
+            'sq': (u'Kategori e zhvendosur',
+                   u'Category redirect',),
             'tl': (u'Category redirect',),
-            'tr': (u'Kategori yönlendirme',),
+            'tr': (u'Kategori yönlendirme',
+                   u'Kat redir',),
             'uk': (u'Categoryredirect',),
-            'vi': (u'Đổi hướng thể loại',),
+            'vi': (u'Đổi hướng thể loại',
+                   u'Thể loại đổi hướng',
+                   u'Chuyển hướng thể loại',
+                   u'Categoryredirect',
+                   u'Category redirect',
+                   u'Catredirect',
+                   u'Categoryredirect',),
             'yi': (u'קאטעגאריע אריבערפירן',),
-            'zh': (u'分类重定向',),
-            'zh-yue': (u'分類彈去',),
+            'zh': (u'分类重定向',
+                   u'Cr',
+                   u'CR',
+                   u'Cat-redirect',),
+            'zh-yue': (u'Category redirect',
+                       u'分類彈去',
+                       u'分類跳轉',),
         }
         
         self.disambiguationTemplates = {

Modified: trunk/pywikipedia/family.py
===================================================================
--- trunk/pywikipedia/family.py	2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/family.py	2009-01-18 22:23:28 UTC (rev 6266)
@@ -2852,7 +2852,7 @@
         }
 
         # A list of category redirect template names in different languages
-        # Note: It is *not* necessary to list template redirects here
+        # Note: It *is* necessary to list template redirects here
         self.category_redirect_templates = {
             '_default': []
         }

Modified: trunk/pywikipedia/redirect.py
===================================================================
--- trunk/pywikipedia/redirect.py	2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/redirect.py	2009-01-18 22:23:28 UTC (rev 6266)
@@ -252,7 +252,7 @@
             mysite = wikipedia.getSite()
             # retrieve information from the live wiki's maintenance page
             # double redirect maintenance page's URL
-            # wikipedia.config.special_page_limit = 1000
+            wikipedia.config.special_page_limit = 1000
             path = mysite.double_redirects_address(default_limit = False)
             wikipedia.output(u'Retrieving special page...')
             maintenance_txt = mysite.getUrl(path)

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/wikipedia.py	2009-01-18 22:23:28 UTC (rev 6266)
@@ -3415,7 +3415,13 @@
                         break
                     groupID = groupMatch.group('name') or int(groupMatch.group('number'))
                     replacement = replacement[:groupMatch.start()] + match.group(groupID) + replacement[groupMatch.end():]
-            text = text[:match.start()] + replacement + text[match.end():]
+            try:
+                text = text[:match.start()] + replacement + text[match.end():]
+            except:
+                print text
+                print match.start(), match.end()
+                print replacement
+                raise
 
             # continue the search on the remaining text
             if allowoverlap:

Modified: trunk/pywikipedia/xmlreader.py
===================================================================
--- trunk/pywikipedia/xmlreader.py	2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/xmlreader.py	2009-01-18 22:23:28 UTC (rev 6266)
@@ -160,8 +160,8 @@
             # Remove trailing newlines and spaces
             while text and text[-1] in '\n ':
                 text = text[:-1]
-            # Replace newline by cr/nl
-            text = u'\r\n'.join(text.split('\n'))
+##            # Replace newline by cr/nl
+##            text = u'\r\n'.join(text.split('\n'))
             # Decode the timestamp
             timestamp = (self.timestamp[0:4]+
                          self.timestamp[5:7]+





More information about the Pywikipedia-l mailing list