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

Modify the database rule to validate the value of origin field.

parent 3699a5d8
...@@ -19,7 +19,8 @@ from gluon.tools import PluginManager ...@@ -19,7 +19,8 @@ from gluon.tools import PluginManager
from regex import (REG_COLLABORATION, from regex import (REG_COLLABORATION,
REG_CONF_DATES, REG_CONF_DATES,
REG_DEFENSE, REG_DEFENSE,
REG_SUBMITTED) REG_SUBMITTED,
REG_VALID_ORIGIN)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# #
......
...@@ -37,7 +37,7 @@ T("Preprint identifier separated by comma: arXiv:0906.1516") ...@@ -37,7 +37,7 @@ T("Preprint identifier separated by comma: arXiv:0906.1516")
tp_report_numbers = \ tp_report_numbers = \
T("Report identifier separated by comma: LHCb-PROC-2008-04") T("Report identifier separated by comma: LHCb-PROC-2008-04")
tp_submitted = \ tp_submitted = \
T("Date of submission to a publisher: 2011-12-13 or 2011-12") T("Date of submission to a publisher: 2011-12-13 or 2011-12")
...@@ -116,7 +116,7 @@ db.publications.id_publishers.requires = IS_IN_DB(db, 'publishers.abbreviation') ...@@ -116,7 +116,7 @@ db.publications.id_publishers.requires = IS_IN_DB(db, 'publishers.abbreviation')
db.publications.conference_dates.requires = IS_EMPTY_OR(IS_MATCH(REG_CONF_DATES)) db.publications.conference_dates.requires = IS_EMPTY_OR(IS_MATCH(REG_CONF_DATES))
db.publications.conference_url.requires = IS_EMPTY_OR(IS_URL()) db.publications.conference_url.requires = IS_EMPTY_OR(IS_URL())
db.publications.origin.requires = IS_EMPTY_OR(IS_URL()) db.publications.origin.requires = IS_EMPTY_OR(IS_MATCH(REG_VALID_ORIGIN))
db.publications.publication_url.requires = IS_EMPTY_OR(IS_URL()) db.publications.publication_url.requires = IS_EMPTY_OR(IS_URL())
# rule: 2012-12 or 2012-12-31 # rule: 2012-12 or 2012-12-31
......
...@@ -34,3 +34,7 @@ REG_DEFENSE = r'\d{2} [A-Z][a-z]{2} \d{4}' ...@@ -34,3 +34,7 @@ REG_DEFENSE = r'\d{2} [A-Z][a-z]{2} \d{4}'
# - 2012-12-31 # - 2012-12-31
# #
REG_SUBMITTED = r'\d{4}-\d{2}(-\d{2})?' REG_SUBMITTED = r'\d{4}-\d{2}(-\d{2})?'
# Valid origin Field
REG_VALID_ORIGIN = \
r'^http[s]?://[\w\.]+/record/\d+(, http://[\w\.]+/record/\d+)?$'
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