Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 15d50703 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update CheckAndFix._get_reg_institute to add beginning and end string character.

parent 3b693acb
......@@ -110,23 +110,28 @@ class CheckAndFix(object):
app = current.app
reg_institute = app.reg_institute
# regular expression for the affiliation is not defined
# build it using the affiliation keys.
# regular expression for the affiliation keys
# protect special character
# add start and end of string for an exact match
if not reg_institute:
iterselect = db(db.affiliation_keys.id > 0).iterselect()
reg_institute = \
u"|".join(imap(
lambda row: u"%(key_u)s%(key_v)s" % row, iterselect))
lst = []
for row in db(db.affiliation_keys.id > 0).iterselect():
val = row.key_u
# protect special character
reg_institute = (reg_institute
.replace("(", "\\(")
.replace(")", "\\)")
.replace("&", "\\&")
.replace("$", "\\$")
.replace("+", "\\+")
.replace("?", "\\?"))
val = (val
.replace("(", "\(")
.replace(")", "\)")
.replace("&", "\&")
.replace("$", "\$")
.replace("+", "\+")
.replace("?", "\?"))
val = r"(^|\|){}($|\|)" .format(val)
lst.append(val)
reg_institute = r"|".join(lst)
return reg_institute
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment