[Pywikipedia-l] SVN: [4788] trunk/pywikipedia/image.py

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Mon Dec 31 20:27:26 UTC 2007


Revision: 4788
Author:   rotem
Date:     2007-12-31 20:27:26 +0000 (Mon, 31 Dec 2007)

Log Message:
-----------
Fixing last commit.

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

Modified: trunk/pywikipedia/image.py
===================================================================
--- trunk/pywikipedia/image.py	2007-12-31 20:25:04 UTC (rev 4787)
+++ trunk/pywikipedia/image.py	2007-12-31 20:27:26 UTC (rev 4788)
@@ -102,21 +102,22 @@
         # empty string if there are none.
 
         replacements = []
+        site = wikipedia.getSite()
 
-        if not wikipedia.getSite().nocapitalize:
+        if not site.nocapitalize:
             old = '[' + self.oldImage[0].upper() + self.oldImage[0].lower() + ']' + self.oldImage[1:]
         else:
             old = self.oldImage
 
         old = re.sub('[_ ]', '[_ ]', old)
         if not self.loose or not self.newImage:
-            ImageRegex = re.compile(r'\[\[ *(?:' + '|'.join(wikipedia.getSite().namespace(6, all = True)) + ')\s*:\s*' + old + ' *(?P<parameters>\|[^\n]+|) *\]\]')
+            ImageRegex = re.compile(r'\[\[ *(?:' + '|'.join(site.namespace(6, all = True)) + ')\s*:\s*' + old + ' *(?P<parameters>\|[^\n]+|) *\]\]')
         else:
             ImageRegex = re.compile(r'' + old)
 
         if self.newImage:
             if not self.loose:
-                replacements.append((ImageRegex, '[[(?:' + '|'.join(wikipedia.getSite().namespace(6, all = True)) + ')\s*:\s*' + self.newImage + '\g<parameters>]]'))
+                replacements.append((ImageRegex, '[[' + site.image_namespace() + ':' + self.newImage + '\g<parameters>]]'))
             else:
                 replacements.append((ImageRegex, self.newImage))
         else:





More information about the Pywikipedia-l mailing list