Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
15d50703
Commit
15d50703
authored
Oct 26, 2019
by
LE GAC Renaud
Browse files
Update CheckAndFix._get_reg_institute to add beginning and end string character.
parent
3b693acb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+19
-14
No files found.
modules/harvest_tools/checkandfix.py
View file @
15d50703
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment