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
fe39f96b
Commit
fe39f96b
authored
Sep 24, 2015
by
LE GAC Renaud
Browse files
Replace CheckAndFix.fix_oai by CheckAndFix.is_bad_oai_used.
parent
65cee30d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
31 deletions
+15
-31
modules/harvest_tools/articles.py
modules/harvest_tools/articles.py
+0
-1
modules/harvest_tools/automaton.py
modules/harvest_tools/automaton.py
+4
-0
modules/harvest_tools/notes.py
modules/harvest_tools/notes.py
+0
-1
modules/harvest_tools/preprints.py
modules/harvest_tools/preprints.py
+0
-1
modules/harvest_tools/proceedings.py
modules/harvest_tools/proceedings.py
+0
-1
modules/harvest_tools/reports.py
modules/harvest_tools/reports.py
+0
-1
modules/harvest_tools/talks.py
modules/harvest_tools/talks.py
+0
-1
modules/harvest_tools/thesis.py
modules/harvest_tools/thesis.py
+0
-1
modules/invenio_tools/checkandfix.py
modules/invenio_tools/checkandfix.py
+11
-24
No files found.
modules/harvest_tools/articles.py
View file @
fe39f96b
...
...
@@ -64,7 +64,6 @@ class Articles(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/harvest_tools/automaton.py
View file @
fe39f96b
...
...
@@ -280,6 +280,10 @@ class Automaton(object):
print
"check record"
try
:
if
self
.
check
.
is_bad_oai_used
(
record
):
self
.
logs
[
-
1
].
idle
(
MSG_IN_DB
,
record
.
year
())
return
False
self
.
check
.
temporary_record
(
record
)
self
.
check
.
authors
(
record
)
self
.
check
.
my_affiliation
(
record
,
self
.
id_project
,
self
.
id_team
)
...
...
modules/harvest_tools/notes.py
View file @
fe39f96b
...
...
@@ -38,7 +38,6 @@ class Notes(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/harvest_tools/preprints.py
View file @
fe39f96b
...
...
@@ -60,7 +60,6 @@ class Preprints(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/harvest_tools/proceedings.py
View file @
fe39f96b
...
...
@@ -46,7 +46,6 @@ class Proceedings(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/harvest_tools/reports.py
View file @
fe39f96b
...
...
@@ -45,7 +45,6 @@ class Reports(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/harvest_tools/talks.py
View file @
fe39f96b
...
...
@@ -42,7 +42,6 @@ class Talks(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/harvest_tools/thesis.py
View file @
fe39f96b
...
...
@@ -41,7 +41,6 @@ class Thesis(Automaton):
self
.
check
.
format_authors
(
record
,
format_author_fr
)
self
.
check
.
get_my_authors
(
record
,
family_name_fr
)
self
.
check
.
fix_oai
(
record
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
.
year
())
...
...
modules/invenio_tools/checkandfix.py
View file @
fe39f96b
...
...
@@ -408,45 +408,32 @@ class CheckAndFix(object):
else
:
raise
CheckException
(
MSG_WELL_FORMED_CONF_DATES
)
def
fix_oai
(
self
,
record
):
def
is_bad_oai_used
(
self
,
record
):
"""The id in the OAI field might be different from the record id.
I
n INVENIO there is a mechanism to
redirect to
the correct on
e
The fix depend on the content of the database
I
t happens when an old record is
redirect
ed
to
new one for obscur
e
reasons.
Return C{TRue} if the "bad OAI" is found in the database.
@type record: L{Record}
@param record:
@rtype: bool
"""
value
=
record
.
oai
()
match
=
REG_OAI
.
match
(
value
)
myid
=
record
.
id
()
# The id in the OAI field might be different from the record id.
# In INVENIO there is a mechanism to redirect to the correct one
#
# The fix depend on the content of the database
if
match
.
group
(
2
)
!=
myid
:
db
=
self
.
db
# The record OAI is already used in the database. Do nothing
oai_url
=
OAI_URL
%
(
match
.
group
(
1
),
match
.
group
(
2
))
if
get_id
(
db
.
publications
,
origin
=
oai_url
):
return
# The OAI based on the record id is already used in the database.
# Modify the record OAI
oai_url
=
OAI_URL
%
(
match
.
group
(
1
),
myid
)
if
get_id
(
db
.
publications
,
origin
=
oai_url
):
# the location of the oai information depends on the store
# cds: (248, a), inspirehep: (909C0, o)
if
u
"0248"
in
record
:
field
,
subfield
=
u
"0248"
,
"a"
elif
u
"909CO"
in
record
:
field
,
subfield
=
u
"909CO"
,
"o"
# The bad OAI is already used in the database
bad_oai_url
=
OAI_URL
%
(
match
.
group
(
1
),
match
.
group
(
2
))
if
get_id
(
db
.
publications
,
origin
=
bad_oai_url
):
return
True
re
cord
[
field
][
subfield
]
=
OAI_INVENIO
%
(
match
.
group
(
1
),
myid
)
re
turn
False
def
format_authors
(
self
,
record
,
func
):
"""Format the author names using the function func.
...
...
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