DrTrigon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/115382

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/82/115382/1

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: newchange
Gerrit-Change-Id: I35633d22f9f96f776198344cb7c1f89f1e8e9e12
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <[email protected]>

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

Reply via email to