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
from regex import (REG_COLLABORATION,
REG_CONF_DATES,
REG_DEFENSE,
REG_SUBMITTED)
REG_SUBMITTED,
REG_VALID_ORIGIN)
#-------------------------------------------------------------------------------
#
......
......@@ -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_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())
# rule: 2012-12 or 2012-12-31
......
......@@ -34,3 +34,7 @@ REG_DEFENSE = r'\d{2} [A-Z][a-z]{2} \d{4}'
# - 2012-12-31
#
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