Commit 70adb82b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update automatons to improve reject messages

parent 2e0c065c
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"'et al.' in authors": "'et al.' dans les authors", "'et al.' in authors": "'et al.' dans les authors",
"'last_name'": "'nom de famille'", "'last_name'": "'nom de famille'",
"'RecordConf' object has no attribute 'country'": "'RecordConf' object has no attribute 'country'", "'RecordConf' object has no attribute 'country'": "'RecordConf' object has no attribute 'country'",
"'str' object is not callable": "'str' object is not callable",
'A report already exists with the same title': 'Un rapport existe deja avec le même titre', 'A report already exists with the same title': 'Un rapport existe deja avec le même titre',
'A talk/proceeding already exists with the same:': 'Un acte ou une présentation existe déja avec le même:', 'A talk/proceeding already exists with the same:': 'Un acte ou une présentation existe déja avec le même:',
'Abbreviation': 'Abréviation', 'Abbreviation': 'Abréviation',
...@@ -599,6 +600,9 @@ ...@@ -599,6 +600,9 @@
'Reject preprint is a published paper': 'Rejeté ce preprint est un article publié', '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 preprint is a thesis': 'Rejeté ce preprint est une thèse',
'Reject publication is a preprint': 'Rejeté la publication est un preprint', 'Reject publication is a preprint': 'Rejeté la publication est un preprint',
'Reject publication is a proceeding': 'Rejeté la publication est un proceeding',
'Reject publication is not a preprint': "Rejeté la publication n'est pas un preprint",
'Reject publication is not and article': "Rejeté la publication n'est pas un article",
'Reject publisher is unknown.': "Rejeté l'éditeur est inconnu.", 'Reject publisher is unknown.': "Rejeté l'éditeur est inconnu.",
'Reject publishers is not defined': "Rejeté la revue n'est pas définie", '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 submission date is not well formed': "Rejeté la date de soumission n'est pas correcte",
......
...@@ -6,13 +6,13 @@ from .base import (learn_my_authors, ...@@ -6,13 +6,13 @@ from .base import (learn_my_authors,
MSG_CRASH, MSG_CRASH,
MSG_FIX_ORIGIN, MSG_FIX_ORIGIN,
MSG_IN_DB, MSG_IN_DB,
MSG_IS,
MSG_LOAD, MSG_LOAD,
T4, T4,
T6) T6)
from plugin_dbui import get_id, UNDEF_ID from plugin_dbui import get_id, UNDEF_ID
from store_tools import CheckException from store_tools import CheckException
MSG_IS_PREPRINT = "Reject publication is a preprint"
MSG_NO_EDITOR = "Reject article is not published" MSG_NO_EDITOR = "Reject article is not published"
MSG_NOT_ARTICLE = "Reject publication is not and article" MSG_NOT_ARTICLE = "Reject publication is not and article"
MSG_TRANSFORM_PREPRINT = "Transform the preprint into an article" MSG_TRANSFORM_PREPRINT = "Transform the preprint into an article"
...@@ -58,8 +58,7 @@ class Articles(Automaton): ...@@ -58,8 +58,7 @@ class Articles(Automaton):
stype = record.subtype() stype = record.subtype()
if stype != "article": if stype != "article":
msg = (MSG_IS_PREPRINT if stype == "preprint" else MSG_NOT_ARTICLE) self.logs[-1].reject(MSG_IS.format(stype), record)
self.logs[-1].reject(msg, record)
return False return False
try: try:
......
...@@ -6,6 +6,7 @@ DRY_RUN = "dry run" ...@@ -6,6 +6,7 @@ DRY_RUN = "dry run"
MSG_CRASH = "Crash: %s" MSG_CRASH = "Crash: %s"
MSG_FIX_ORIGIN = "Fixed the origin field" MSG_FIX_ORIGIN = "Fixed the origin field"
MSG_IN_DB = "Already in the database" MSG_IN_DB = "Already in the database"
MSG_IS = "Reject publication is a {}"
MSG_LOAD = "Load in the database" MSG_LOAD = "Load in the database"
T4 = " "*4 T4 = " "*4
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
""" """
from .automaton import Automaton from .automaton import Automaton
from .base import MSG_CRASH, MSG_LOAD, T4 from .base import MSG_CRASH, MSG_IS, MSG_LOAD, T4
from plugin_dbui import UNDEF_ID from plugin_dbui import UNDEF_ID
from store_tools import CheckException from store_tools import CheckException
...@@ -35,8 +35,9 @@ class Notes(Automaton): ...@@ -35,8 +35,9 @@ class Notes(Automaton):
""" """
self.logger.debug(f"{T4}check and fix record (note)") self.logger.debug(f"{T4}check and fix record (note)")
if record.subtype() != "note": stype = record.subtype()
self.logs[-1].reject(MSG_NOT_NOTE, record) if stype != "note":
self.logs[-1].reject(MSG_IS.format(stype), record)
return False return False
try: try:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
""" """
from .automaton import Automaton from .automaton import Automaton
from .base import MSG_CRASH, MSG_LOAD, T4 from .base import MSG_CRASH, MSG_IS, MSG_LOAD, T4
from plugin_dbui import get_id, UNDEF_ID from plugin_dbui import get_id, UNDEF_ID
from store_tools import (CheckException, from store_tools import (CheckException,
RecordCdsConfPaper, RecordCdsConfPaper,
...@@ -43,8 +43,9 @@ class Preprints(Automaton): ...@@ -43,8 +43,9 @@ class Preprints(Automaton):
""" """
self.logger.debug(f"{T4}check and fix record (preprint)") self.logger.debug(f"{T4}check and fix record (preprint)")
if record.subtype() != "preprint": stype = record.subtype()
self.logs[-1].reject(MSG_NOT_PREPRINT, record) if stype != "preprint":
self.logs[-1].reject(MSG_IS.format(stype), record)
return False return False
if record.is_published(): if record.is_published():
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
""" """
from .automaton import Automaton from .automaton import Automaton
from .base import MSG_CRASH, MSG_LOAD, T4 from .base import MSG_CRASH, MSG_IS, MSG_LOAD, T4
from plugin_dbui import get_id, UNDEF_ID from plugin_dbui import get_id, UNDEF_ID
from store_tools import CheckException from store_tools import CheckException
...@@ -41,8 +41,9 @@ class Proceedings(Automaton): ...@@ -41,8 +41,9 @@ class Proceedings(Automaton):
""" """
self.logger.debug(f"{T4}check and fix record (proceeding)") self.logger.debug(f"{T4}check and fix record (proceeding)")
if record.subtype() != "proceeding": stype = record.subtype()
self.logs[-1].reject(MSG_NOT_PROCEEDING, record) if stype != "proceeding":
self.logs[-1].reject(MSG_IS.format(stype), record)
return False return False
try: try:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import re import re
from .automaton import Automaton from .automaton import Automaton
from .base import MSG_CRASH, MSG_LOAD, T4 from .base import MSG_CRASH, MSG_IS, MSG_LOAD, T4
from plugin_dbui import get_id, UNDEF_ID from plugin_dbui import get_id, UNDEF_ID
from store_tools import CheckException from store_tools import CheckException
...@@ -31,8 +31,9 @@ class Thesis(Automaton): ...@@ -31,8 +31,9 @@ class Thesis(Automaton):
""" """
self.logger.debug(f"{T4}check and fix record (thesis)") self.logger.debug(f"{T4}check and fix record (thesis)")
if record.subtype() != "thesis": stype = record.subtype()
self.logs[-1].reject(MSG_NOT_THESIS, record) if stype != "thesis":
self.logs[-1].reject(MSG_IS.format(stype), record)
return False return False
try: try:
......
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