Commit ff0c9981 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update modules to revisit rule for publication URL

parent 9e44388e
......@@ -129,7 +129,7 @@
'check and validate': 'vérifier et valider',
'Check and validate took %s seconds': 'Vérifier et valider a duré %s secondes',
'Check latex syntax in the title': 'Vérifier la syntaxe latex dans le titre',
'Check that the publication URL corresponds to a pdf file.': 'Check that the publication URL corresponds to a pdf file.',
'Check the publication URL': "Vérifier l'URL de la publication",
'Check to delete': 'Check to delete',
'citations': 'citations',
'citations/article (avg):': 'citations/article (avg): ',
......@@ -373,6 +373,7 @@
'Lignes': 'Lignes',
'line chart': 'line chart',
'List': 'Liste',
'list index out of range': 'list index out of range',
'List of authors belonging to your institute, separated by comma: P.-Y. Doe, J. Smith': 'Liste des auteurs du labaoratoire, séparé par une virgule : P.-Y. Doe, J. Smith',
'List of authors separated by comma: J. Doe, P.-Y. Smith': 'Liste des auteurs séparé par une virgule : J. Doe, P.-Y. Smith',
'List of category codes separated by a comma: ACL, ACLN. Only the publications with the given categories will be processed in the section.': 'Liste de catégorie (code) spéraré par une virgule: ACL, ACLN. Seules les publications de ces categories seront analysées dans cette section.',
......
......@@ -9,6 +9,7 @@ from plugin_dbui import (UNDEF,
UNDEF_ID,
get_where_query)
REG_URL_PUBLI = re.compile(regex.REG_URL_PUBLI)
# syntax for the submission date YYYY-MM or YYYY-MM-DD
REG_SUBMITTED = re.compile(regex.REG_SUBMITTED)
......@@ -81,9 +82,9 @@ def check_publication(row):
# publication URL
publication_url = publication.publication_url
if publication_url:
if "pdf" not in publication_url:
if REG_URL_PUBLI.match(publication_url) is None:
text = \
T("Check that the publication URL corresponds to a pdf file.")
T("Check the publication URL")
li.append(text)
# latex syntax
......
......@@ -30,6 +30,7 @@ from pydal import Field
from regex import (REG_COLLABORATION,
REG_CONF_DATES,
REG_DEFENSE,
REG_URL_PUBLI,
REG_SUBMITTED,
REG_VALID_ORIGIN)
......@@ -50,6 +51,7 @@ class Core(object):
"""Create the ``publications`` table and its foreign tables.
"""
@staticmethod
def _protect(table):
"""protect the content of the table.
......@@ -534,12 +536,12 @@ class Core(object):
table.id_teams.requires = IS_IN_DB(db, "teams.team")
table.origin.requires = IS_EMPTY_OR(IS_MATCH(REG_VALID_ORIGIN))
table.publication_url.requires = IS_EMPTY_OR(IS_URL())
table.publication_url.requires = IS_EMPTY_OR(IS_MATCH(REG_URL_PUBLI))
# rule: 2012-12 or 2012-12-31
table.submitted.requires = IS_MATCH(REG_SUBMITTED)
table.year.requires = IS_INT_IN_RANGE(1900, current.request.now.year+1)
table.year.requires = IS_INT_IN_RANGE(1900, current.request.now.year + 1)
return table
......
......@@ -28,6 +28,10 @@ REG_CONF_DATES = r"%s|%s|%s" % (reg1, reg2, reg3)
#
REG_DEFENSE = r"\d{2} [A-Z][a-z]{2} \d{4}"
# Valid the URL to the publication, in most of the case a pdf file
# Accept URL with space, dot, #-;~, not finishing by pdf etc
REG_URL_PUBLI = r"^https?://[\w#:~&%=\(\)\?\-\./ ]+$"
# Valid Submitted field
# - 2012-12
# - 2012-12-31
......
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