Revision: 5910 Author: nicdumz Date: 2008-09-20 03:24:14 +0000 (Sat, 20 Sep 2008)
Log Message: ----------- re.escaping image name, image names such as '(Peyssonnelia sp.2).jpg' were raising sre_constants.error here
Modified Paths: -------------- trunk/pywikipedia/image.py
Modified: trunk/pywikipedia/image.py =================================================================== --- trunk/pywikipedia/image.py 2008-09-19 15:00:13 UTC (rev 5909) +++ trunk/pywikipedia/image.py 2008-09-20 03:24:14 UTC (rev 5910) @@ -124,10 +124,11 @@ 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*' + old + ' *(?P<parameters>|[^\n]+|) *]]') + ImageRegex = re.compile(r'[[ *(?:' + '|'.join(site.namespace(6, all = True)) + ')\s*:\s*' + escaped + ' *(?P<parameters>|[^\n]+|) *]]') else: - ImageRegex = re.compile(r'' + old) + ImageRegex = re.compile(r'' + escaped)
if self.newImage: if not self.loose: