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
Open sidebar
limbra
limbra
Commits
b47d5d10
Commit
b47d5d10
authored
Oct 08, 2015
by
LE GAC Renaud
Browse files
Modify the database rule to validate the value of origin field.
parent
3699a5d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
models/common_settings.py
models/common_settings.py
+2
-1
models/db1_publications.py
models/db1_publications.py
+2
-2
modules/regex.py
modules/regex.py
+4
-0
No files found.
models/common_settings.py
View file @
b47d5d10
...
...
@@ -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
)
#-------------------------------------------------------------------------------
#
...
...
models/db1_publications.py
View file @
b47d5d10
...
...
@@ -37,7 +37,7 @@ T("Preprint identifier separated by comma: arXiv:0906.1516")
tp_report_numbers
=
\
T
(
"Report identifier separated by comma: LHCb-PROC-2008-04"
)
tp_submitted
=
\
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')
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
...
...
modules/regex.py
View file @
b47d5d10
...
...
@@ -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+)?$'
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