https://bugzilla.wikimedia.org/show_bug.cgi?id=55170

       Web browser: ---
            Bug ID: 55170
           Summary: trunk 10450 not py2.6 compatible
           Product: Pywikibot
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1519/
Reported by: drtrigon
Created on: 2012-10-09 15:08:56
Subject: trunk 10450 not py2.6 compatible
Original description:
Hello all\!

As Merlijn suggested at \[1\] I should also report this here too. I would solve
it myself but a quick shot does not seam appropriate.

\[1\] https://jira.toolserver.org/browse/TS-1466

Python code using:
>>> import re
>>> re.sub\(..., flags=...\)

does not work in python 2.6 because the optional parameter \'flags\' was
introduced in python 2.7. As Merlijn noted, this should be replaced by
>>> re.compile\(..., flags=...\).sub\(...\)

A fast \'grep \"flags\" \*\' in my pywikipedia directory of revision 10450,
yields at least following matches:

imagecopy\_self.py:                match = re.search\(regex, text,
flags=re.IGNORECASE\)
imagecopy\_self.py:                contents\[u\'permission\'\] = re.sub\(regex,
u\'\', contents\[u\'permission\'\], flags=re.IGNORECASE\)
imagecopy\_self.py:            text = re.sub\(toRemove, u\'\', text,
flags=re.IGNORECASE\)
imagecopy\_self.py:            text = re.sub\(regex, u\'\', text,
flags=re.IGNORECASE\)
imagecopy\_self.py:            match = re.search\(regex, text,
flags=re.IGNORECASE\)
imagecopy\_self.py:                result = re.sub\(regex, replacement,
match.group\(0\), flags=re.IGNORECASE\)

...so there are at least 4 problematic cases which should be changed. I am not
aware if a similar issues exists with \'re.search\'.

Thanks and greetings

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to