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
92abcd5a
Commit
92abcd5a
authored
Sep 01, 2016
by
LE GAC Renaud
Browse files
Add the processing behind the wizard AffiliationFromPublication.
parent
386c8e3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
controllers/wizards.py
controllers/wizards.py
+25
-3
No files found.
controllers/wizards.py
View file @
92abcd5a
...
...
@@ -59,13 +59,35 @@ def affiliation_publication():
publication_id
=
vars
.
publication_id
publication_store
=
vars
.
publication_store
# find the record for the institute
# find the publication
record
=
load_record
(
publication_store
,
publication_id
)
if
record
is
None
:
raise
HTTP
(
500
,
"Record not found!"
)
# extract the keys defining the affiliation
# find the author
pattern
=
"^%s, %s$"
%
(
family_name
.
strip
(),
first_name
.
strip
())
reg
=
re
.
compile
(
pattern
,
re
.
IGNORECASE
)
rule
=
None
# check that the rules does not exist
if
"700"
in
record
and
isinstance
(
record
[
u
"700"
],
list
):
for
di
in
record
[
u
"700"
]:
author
=
di
[
"a"
]
if
reg
.
match
(
author
):
rule
=
dict
(
u
=
di
[
"u"
])
if
"v"
in
di
:
rule
[
"v"
]
=
di
[
"v"
]
break
if
rule
is
None
:
raise
HTTP
(
500
,
"Author not found!"
)
# check that the rules does not exist
# load new rules
if
get_id
(
db
.
affiliation_rules
,
**
rule
)
is
None
:
db
.
affiliation_rules
[
0
]
=
rule
else
:
raise
HTTP
(
500
,
"Rule already exists!"
)
return
...
...
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