Revision: 6770 Author: nicdumz Date: 2009-04-30 09:21:06 +0000 (Thu, 30 Apr 2009)
Log Message: ----------- [ 2783898 ] Fix links in CommonsDelinker edit summary on Commons Kudos to Ilmari Karonen for this patch :)
Modified Paths: -------------- trunk/pywikipedia/commonsdelinker/delinker.py
Modified: trunk/pywikipedia/commonsdelinker/delinker.py =================================================================== --- trunk/pywikipedia/commonsdelinker/delinker.py 2009-04-30 09:07:23 UTC (rev 6769) +++ trunk/pywikipedia/commonsdelinker/delinker.py 2009-04-30 09:21:06 UTC (rev 6770) @@ -343,8 +343,9 @@ def get_summary(self, site, image, admin, reason, replacement): """ Get the summary template and substitute the correct values.""" - # FIXME: Don't insert commons: on local delink # FIXME: Hardcode is EVIL + if site.lang != 'commons': + reason = reason.replace('[[', '[[commons:') if replacement: tlp = self.CommonsDelinker.SummaryCache.get(site, 'replace-I18n') else: @@ -354,10 +355,10 @@ if replacement: tlp = tlp.replace('$2', replacement) tlp = tlp.replace('$3', unicode(admin)) - tlp = tlp.replace('$4', unicode(reason).replace('[[', '[[commons:')) + tlp = tlp.replace('$4', unicode(reason)) else: tlp = tlp.replace('$2', unicode(admin)) - tlp = tlp.replace('$3', reason.replace('[[', '[[commons:')) + tlp = tlp.replace('$3', unicode(reason))
return tlp