Skip to content
Snippets Groups Projects
Commit 3665f526 authored by legac's avatar legac
Browse files

Improved files organization for the database model.

parent e921108f
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
""" db
""" db core
Defined the database tables for your applications.
Core tables for the application.
"""
import locale
......@@ -46,79 +46,41 @@ year = datetime.now().year
#-------------------------------------------------------------------------------
#
# basic tables
# core tables
#
#-------------------------------------------------------------------------------
db.define_table("categories",
Field("code", "string", notnull=True, unique=True),
Field("definition", "text", notnull=True))
Field("definition", "text", notnull=True),
migrate="categories.table")
db.categories.code.requires = IS_MATCH('^[0-9]+$')
db.define_table("collaborations",
Field("collaboration", "string", notnull=True, unique=True))
Field("collaboration", "string", notnull=True, unique=True),
migrate="collaborations.table")
db.define_table("countries",
Field("country", "string", notnull=True, unique=True),
Field("abbreviation", "string", notnull=True))
Field("abbreviation", "string", notnull=True),
migrate="countries.table")
db.define_table("projects",
Field("project", "string", notnull=True, unique=True))
Field("project", "string", notnull=True, unique=True),
migrate="projects.table")
db.define_table("publishers",
Field("publisher", "string", notnull=True, unique=True),
Field("abbreviation", "string", notnull=True))
Field("abbreviation", "string", notnull=True),
migrate="publishers.table")
db.define_table("reports",
Field("type", "string", notnull=True, unique=True))
Field("type", "string", notnull=True, unique=True),
migrate="reports.table")
db.define_table("teams",
Field("team", "string", notnull=True, unique=True))
#-------------------------------------------------------------------------------
#
# technical tables
#
#-------------------------------------------------------------------------------
tp_category = \
"Publication category associated to the record."
tp_collections = \
"List of collections separated by commma: LHCb Papers, LHCb Talks"
tp_controller = \
"The name of the web2py controller running the search: articles, proceedings,..."
tp_host = \
"Address of the invenio store where the search is performed."
tp_max_records = \
"Maximum number of records which can be retrieved from a search."
tp_ratio = \
"Parameter for fuzzy string search."
db.define_table("harvesters",
Field("id_teams", db.teams, default=undef_id, label='Team'),
Field("controller", "string", notnull=True, comment=tp_controller),
Field("host", "string", notnull=True, default='cdsweb.cern.ch', comment=tp_host),
Field("collections", "string", comment=tp_collections),
Field("max_records", "integer", notnull=True, default=200, comment=tp_max_records),
Field("ratio", "double", notnull=True, default=1.0, comment=tp_ratio),
Field("id_categories", db.categories, default=undef_id, label='Category', comment=tp_category))
db.harvesters.controller.requires = \
IS_IN_SET(['articles', 'proceedings', 'reports', 'talks'])
db.harvesters.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
db.harvesters.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
db.harvesters.ratio.requires = \
IS_FLOAT_IN_RANGE(0., 1.0)
Field("team", "string", notnull=True, unique=True),
migrate="teams.table")
#-------------------------------------------------------------------------------
#
......@@ -162,7 +124,8 @@ db.define_table("publications",
Field("authors_cppm", "text", notnull=True, comment=tp_authors_cppm),
Field("id_teams", db.teams, default=undef_id, label='Team'),
Field("id_projects", db.projects, default=undef_id, label='Projects'),
Field("id_categories", db.categories, default=undef_id, label='AERES'))
Field("id_categories", db.categories, default=undef_id, label='AERES'),
migrate="publications.table")
db.publications.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
......
# -*- coding: utf-8 -*-
""" db tools
Configuration tables for the application tools.
"""
tp_category = \
"Publication category associated to the record."
tp_collections = \
"List of collections separated by commma: LHCb Papers, LHCb Talks"
tp_controller = \
"The name of the web2py controller running the search: articles, proceedings,..."
tp_host = \
"Address of the invenio store where the search is performed."
tp_max_records = \
"Maximum number of records which can be retrieved from a search."
tp_ratio = \
"Parameter for fuzzy string search."
db.define_table("harvesters",
Field("id_teams", db.teams, default=undef_id, label='Team'),
Field("controller", "string", notnull=True, comment=tp_controller),
Field("host", "string", notnull=True, default='cdsweb.cern.ch', comment=tp_host),
Field("collections", "string", comment=tp_collections),
Field("max_records", "integer", notnull=True, default=200, comment=tp_max_records),
Field("ratio", "double", notnull=True, default=1.0, comment=tp_ratio),
Field("id_categories", db.categories, default=undef_id, label='Category', comment=tp_category),
migrate="harvesters.table")
db.harvesters.controller.requires = \
IS_IN_SET(['articles', 'proceedings', 'reports', 'talks'])
db.harvesters.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
db.harvesters.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
db.harvesters.ratio.requires = \
IS_FLOAT_IN_RANGE(0., 1.0)
\ No newline at end of file
--------------------------------- CHANGE LOG ----------------------------------
HEAD
- Improve grid filter namely by adding the method append_filter.
- New syntax for grid filter via the method GridModifier.append_filter.
- Improve the files organization defining the model.
- Enable tab scrolling in viewport.
0.4.8.2 (Jul 2012)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment