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
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
limbra
limbra
Commits
344482e0
Commit
344482e0
authored
Oct 19, 2015
by
LE GAC Renaud
Browse files
The class CheckAndFix used the function search_synonym.
parent
739e4103
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
47 deletions
+34
-47
languages/fr-fr.py
languages/fr-fr.py
+6
-0
modules/harvest_tools/base.py
modules/harvest_tools/base.py
+2
-2
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+11
-33
modules/harvest_tools/msg.py
modules/harvest_tools/msg.py
+15
-12
No files found.
languages/fr-fr.py
View file @
344482e0
...
...
@@ -480,7 +480,9 @@
'Reject'
:
'Rejeter'
,
'Reject article is not published'
:
"Rejeté l'article n'est pas publié"
,
'Reject collaboration is not well formed'
:
'Rejeté la collaboration est mal formatté'
,
'Reject collaborations is not defined'
:
"Rejeté la collaboration n'est pas définie"
,
'Reject conference dates is not well formed'
:
'Rejecté les dates de la conférence dates sont mal formatté'
,
'Reject countries is not defined'
:
"Rejeté le pays n'est pas définie"
,
'Reject editor is not well formed'
:
"Rejeté l'éditeur est mal formatté"
,
'Reject incomplete paper reference'
:
'Rejeté la référence du papier est incomplète'
,
'Reject invalid country'
:
'Rejeté pays inconnu'
,
...
...
@@ -502,11 +504,15 @@
'Reject preprint is a conference'
:
'Rejeté ce preprint est une conférence'
,
'Reject preprint is a published paper'
:
'Rejeté ce preprint est un article publié'
,
'Reject preprint is a thesis'
:
'Rejeté ce preprint est une thèse'
,
'Reject publishers is not defined'
:
"Rejeté la revue n'est pas définie"
,
'Reject submission date is not well formed'
:
"Rejeté la date de soumission n'est pas correcte"
,
'Reject the talk match a proceeding'
:
'Rejeté cette présentation correspond à un actes de conférence'
,
'Reject to many first author'
:
'Rejeté trop de premier autheur'
,
'Reject to many submit date'
:
'Rejeté plusieurs date de soumission'
,
'Reject to many year'
:
'Rejeté plusieurs année'
,
'Reject too many collaborations synonyms'
:
'Rejeté synonyme de collaboration défini plusieurs fois'
,
'Reject too many countries synonyms'
:
'Rejeté synonyme de pays défini plusieurs fois'
,
'Reject too many publishers synonyms'
:
'Rejeté synonyme de revue défini plusieurs fois'
,
'Reject XML is not well formed'
:
"Rejeté la chaine XML n'est pas correcte"
,
'Rejected'
:
'Rejeté'
,
"Rejeté la chaine XML n'est pas correcte"
:
"Rejeté la chaine XML n'est pas correcte"
,
...
...
modules/harvest_tools/base.py
View file @
344482e0
...
...
@@ -13,8 +13,8 @@ MSG_CRASH = "Crash: %s"
MSG_FIX_ORIGIN
=
"Fixed the origin field"
MSG_IN_DB
=
"Already in the database"
MSG_LOAD
=
"Load in the database"
MSG_NO_ENTRY
=
"Reject %s is not defined
.
"
MSG_TOOMANY_SYNONYM
=
"Reject too many %s synonyms
.
"
MSG_NO_ENTRY
=
"Reject %s is not defined"
MSG_TOOMANY_SYNONYM
=
"Reject too many %s synonyms"
def
family_name_fr
(
full_name
):
...
...
modules/harvest_tools/checkandfix.py
View file @
344482e0
...
...
@@ -5,12 +5,10 @@
import
re
import
regex
from
base
import
search_synonym
from
exception
import
CheckException
from
invenio_tools
import
(
load_record
,
MSG_NO_COUNTRY
,
MSG_NO_CONF
,
MSG_NO_PUBLISHER
,
MSG_WELL_FORMED_COLLABORATION
,
MSG_NO_THESIS
,
OAI_URL
,
RecordConf
,
...
...
@@ -358,21 +356,16 @@ class CheckAndFix(object):
record (RecordPubli): record describing a publication.
Raises:
Check
Exception: when the collaboration value is
not well form
ed
and
no
t
entered as a synonym.
Tool
Exception: when the collaboration value is
defin
ed
no
r
entered as a synonym.
"""
val
=
record
.
collaboration
()
if
not
val
:
return
if
REG_COLLABORATION
.
match
(
val
):
return
if
self
.
_is_synonym
(
"collaborations"
,
val
):
return
raise
CheckException
(
MSG_WELL_FORMED_COLLABORATION
)
db
=
self
.
db
search_synonym
(
db
.
collaborations
,
"collaboration"
,
val
)
def
country
(
self
,
record
):
"""Check conference country.
...
...
@@ -382,8 +375,8 @@ class CheckAndFix(object):
record (RecordConf): record describing a talk or a proceeding.
Raises:
Check
Exception: when the country is not defined
and
no
t
entered as a synonym.
Tool
Exception: when the country is not defined
no
r
entered as a synonym.
"""
if
not
isinstance
(
record
,
RecordConf
):
...
...
@@ -391,15 +384,7 @@ class CheckAndFix(object):
db
=
self
.
db
val
=
record
.
conference_country
()
id_country
=
get_id
(
db
.
countries
,
country
=
val
)
if
id_country
:
return
if
self
.
_is_synonym
(
"countries"
,
val
):
return
raise
CheckException
(
MSG_NO_COUNTRY
)
search_synonym
(
db
.
countries
,
"country"
,
val
)
def
conference_date
(
self
,
record
):
"""Check conference date.
...
...
@@ -774,8 +759,8 @@ class CheckAndFix(object):
record (RecordPubli): record describing a publication.
Raises:
Check
Exception: when the publisher is not defined
and
no
t
entered as a synonym.
Tool
Exception: when the publisher is not defined
no
r
entered as a synonym.
"""
db
=
self
.
db
...
...
@@ -787,14 +772,7 @@ class CheckAndFix(object):
if
isinstance
(
val
,
list
):
val
=
val
[
0
]
id_publisher
=
get_id
(
db
.
publishers
,
abbreviation
=
val
)
if
id_publisher
:
return
if
self
.
_is_synonym
(
"publishers"
,
val
):
return
raise
CheckException
(
MSG_NO_PUBLISHER
)
search_synonym
(
db
.
publishers
,
"abbreviation"
,
val
)
def
recover_oai
(
self
,
record
,
host
):
"""Recover the OAI identifier when it is not defined
...
...
modules/harvest_tools/msg.py
View file @
344482e0
...
...
@@ -5,12 +5,14 @@
import
json
from
base
import
MSG_NO_ENTRY
,
MSG_TOOMANY_SYNONYM
from
gluon
import
current
from
gluon.storage
import
Storage
from
invenio_tools
import
(
MSG_NO_COUNTRY
,
MSG_NO_PUBLISHER
,
MSG_WELL_FORMED_COLLABORATION
,
OAI_URL
)
from
invenio_tools
import
OAI_URL
MSGS
=
(
MSG_NO_ENTRY
,
MSG_TOOMANY_SYNONYM
)
TABLES
=
(
"collaborations"
,
"countries"
,
"publishers"
)
class
Msg
(
Storage
):
...
...
@@ -117,14 +119,15 @@ class Msg(Storage):
self
.
action
=
'reject'
if
record
is
not
None
:
if
str
(
txt
)
==
MSG_NO_COUNTRY
:
self
.
synonym
=
record
.
country
()
elif
str
(
txt
)
==
MSG_WELL_FORMED_COLLABORATION
:
self
.
synonym
=
record
.
collaboration
()
elif
str
(
txt
)
==
MSG_NO_PUBLISHER
:
self
.
synonym
=
record
.
publisher
()
for
msg
in
MSGS
:
for
tablename
in
TABLES
:
if
str
(
txt
)
==
msg
%
tablename
:
if
tablename
==
"collaborations"
:
self
.
synonym
=
record
.
collaboration
()
elif
tablename
==
"countries"
:
self
.
synonym
=
record
.
country
()
elif
tablename
==
"publishers"
:
self
.
synonym
=
record
.
publisher
()
if
year
is
None
and
record
is
not
None
:
year
=
record
.
year
()
...
...
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