Bugs item #2169485, was opened at 2008-10-15 22:56 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2169485...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: giurrero (giurrero) Assigned to: Nobody/Anonymous (nobody) Summary: image.py bug
Initial Comment: image.py has a bug here:
if not site.nocapitalize: old = '[' + self.oldImage[0].upper() + self.oldImage[0].lower() + ']' + self.oldImage[1:] else: old = self.oldImage
old = re.sub('[_ ]', '[_ ]', old) escaped = re.escape(old) if not self.loose or not self.newImage: ImageRegex = re.compile(r'[[ *(?:' + '|'.join(site.namespace(6, all = True)) + ')\s*:\s*' + escaped + ' *(?P<parameters>|[^\n]+|) *]]') else: ImageRegex = re.compile(r'' + escaped)
the escaping must be the first thing that you do, now if you replace [_ ] with [_ ], and do the escaping:
"my_image" -> "my[ _]image" -> "my[\ _]image"
I think that the solution in wikipedia.py replaceImage will be the best
Pywikipedia [http] trunk/pywikipedia (r5976, Oct 15 2008, 17:28:48) Python 2.5.2 (r252:60911, Aug 1 2008, 00:37:21) [GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]]
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2169485...
pywikipedia-l@lists.wikimedia.org