DrTrigon has submitted this change and it was merged.

Change subject: bugfix; '\number' from e.g. date cause 'sre_constants.error: 
invalid group reference'
......................................................................


bugfix; '\number' from e.g. date cause 'sre_constants.error: invalid group 
reference'

Change-Id: I35633d22f9f96f776198344cb7c1f89f1e8e9e12
---
M catimages.py
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  DrTrigon: Verified; Looks good to me, approved



diff --git a/catimages.py b/catimages.py
index f44de4d..bdfa7bd 100644
--- a/catimages.py
+++ b/catimages.py
@@ -4054,13 +4054,15 @@
     def _append_to_template(self, text, name, append):
         # mask/search template to append to
         pattern = re.compile(u"(\{\{%s.*?\n)(\s*\}\}\n{2})" % name, flags=re.S)
-        template = pattern.search(text).groups()
+        match = pattern.search(text)
+        template = match.groups()
 
         # append to template
         template = u"".join([template[0], append, u"\n", template[1]])
 
         # apply changes
-        text = pattern.sub(template, text)
+        #text = pattern.sub(template, text)  # '\number' from e.g. date cause 
'sre_constants.error: invalid group reference'
+        text = text.replace(match.group(0), template)
         return text
 
     # gather data from all information interfaces

-- 
To view, visit https://gerrit.wikimedia.org/r/115382
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I35633d22f9f96f776198344cb7c1f89f1e8e9e12
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <[email protected]>
Gerrit-Reviewer: DrTrigon <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to