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

Define the application properties authorize_user_login,

authorize_havester_scan and havester_start_year. Deploy the logic for
the last one.
parent b06ce3f2
......@@ -3,6 +3,7 @@
"""
import filters
import harvest_tools
import locale
import plugin_dbui as dbui
......@@ -13,7 +14,6 @@ from callbacks import (INHIBIT_CASCADE_DELETE,
from datetime import datetime
from gluon.tools import PluginManager
import harvest_tools
#-------------------------------------------------------------------------------
#
......
......@@ -2,8 +2,19 @@
""" application
"""
from gluon.storage import Storage
db.define_table("application",
Field("property", "string", length=255, notnull=True, unique=True),
Field("value", "string", length=255),
Field("definition", "text", notnull=True),
migrate="application.table")
#-------------------------------------------------------------------------------
#
# APPLICATION PROPERTIES
#
#-------------------------------------------------------------------------------
app = Storage()
for row in db(db.application).select():
app[row.property] = row.value
\ No newline at end of file
......@@ -23,6 +23,7 @@
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('application')
gridModifier.configure_column('property', width=30)
gridModifier.configure_column('value', width=20)
#-------------------------------------------------------------------------------
#
......
# -*- coding: utf-8 -*-
""" application
Define the application properties
"""
if db(db.application).count() != 3:
if not db(db.application.property=="authorize_harvester_scan").select():
db.application.insert(property='authorize_harvester_scan',
definition="Harvesters are ran automatically "
"when the value is equal to yes "
"or true.")
if not db(db.application.property=="authorize_user_login").select():
db.application.insert(property="authorize_user_login",
definition="Users can login when the value is "
"equal to yes or true.")
if not db(db.application.property=="harvester_start_year").select():
db.application.insert(property="harvester_start_year",
definition="Define the range of years in which "
"the harvesters can be ran. "
"It starts with the given value and "
"ends with the current year.")
......@@ -35,6 +35,13 @@ IS_IN_DB(db, 'projects.project')
virtdb.free_harvester_selector.id_teams.requires = \
IS_IN_DB(db, 'teams.team')
if app.harvester_start_year:
virtdb.free_harvester_selector.year_start.requires = \
IS_INT_IN_RANGE(app.harvester_start_year, year)
virtdb.free_harvester_selector.year_end.requires = \
IS_INT_IN_RANGE(app.harvester_start_year, year)
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
......
......@@ -27,6 +27,13 @@ IS_IN_DB(db, 'teams.team')
virtdb.harvester_selector.mode.requires = \
IS_IN_SET([MODE_DRY_RUN, MODE_LOAD_IN_DB])
if app.harvester_start_year:
virtdb.harvester_selector.year_start.requires = \
IS_INT_IN_RANGE(app.harvester_start_year, year)
virtdb.harvester_selector.year_end.requires = \
IS_INT_IN_RANGE(app.harvester_start_year, year)
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
......
......@@ -27,6 +27,13 @@ IS_IN_DB(db, 'projects.project')
virtdb.run_all_harvesters_selector.id_teams.requires = \
IS_IN_DB(db, 'teams.team')
if app.harvester_start_year:
virtdb.run_all_harvesters_selector.year_start.requires = \
IS_INT_IN_RANGE(app.harvester_start_year, year)
virtdb.run_all_harvesters_selector.year_end.requires = \
IS_INT_IN_RANGE(app.harvester_start_year, year)
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
......
--------------------------------- CHANGELOG ----------------------------------
HEAD
- Migrate to plugin_dbui 0.6.1.0 and web2py 2.9.5
- Migrate to plugin_dbui 0.6.1.1 and web2py 2.9.5
- Define the length of each string field to garanty web2py compatibility.
- Use the controller plugin_dbui/about, documentation and versions.
- Add the field 'origin' in publications.
- Add the table 'application' for configuration parameters.
- Add the application properties authorize_user_login,
authorize_harvester_scan and havester_start_year.
- Implement the logic to limit the year range to run harvesters.
0.8.4 (Feb 2014)
- Migrate to plugin_dbui 0.6.0.11, Ext JS 4.2.1 and MathJax 2.0.3.
......
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