[Pywikipedia-l] SVN: [6061] trunk/pywikipedia/checkimages.py

filnik at svn.wikimedia.org filnik at svn.wikimedia.org
Wed Nov 5 13:20:22 UTC 2008


Revision: 6061
Author:   filnik
Date:     2008-11-05 13:20:22 +0000 (Wed, 05 Nov 2008)

Log Message:
-----------
Another little bugfix as the previous one

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

Modified: trunk/pywikipedia/checkimages.py
===================================================================
--- trunk/pywikipedia/checkimages.py	2008-11-05 13:17:31 UTC (rev 6060)
+++ trunk/pywikipedia/checkimages.py	2008-11-05 13:20:22 UTC (rev 6061)
@@ -959,12 +959,8 @@
                                     commImage = dupComment_image, unver = True)
                 if len(images_to_tag_list) != 0 and not only_report:
                     already_reported_in_past = self.countEdits(u'Image:%s' % images_to_tag_list[-1], self.botolist)
-                    # It's a regex, we need to fix the name in order to make it regex-compatible.
-                    replaces_to_perform = [[' ', '_'], ['(', '\('], [')', '\)'], ['.', '\.'], ['[', '\['], [']', '\]'],
-                                           ['{', '\{'], ['}', '\}']]
-                    for replace_to_perform in replaces_to_perform:
-                        image_to_resub = images_to_tag_list[-1].replace(replace_to_perform[0], replace_to_perform[1])
-                    from_regex = r'\n\*\[\[:%s\]\]' % (self.image_namespace + image_to_resub)
+                    image_to_resub = images_to_tag_list[-1]
+                    from_regex = r'\n\*\[\[:%s\]\]' % re.escape(self.image_namespace + image_to_resub)
                     # Delete the image in the list where we're write on
                     text_for_the_report = re.sub(from_regex, '', text_for_the_report)
                     # if you want only one edit, the edit found should be more than 0 -> num - 1





More information about the Pywikipedia-l mailing list