~sielibre/schooltool.isli/2.10_packaging

« back to all changes in this revision

Viewing changes to src/schooltool/isli/generations/evolve1.py

  • Committer: Douglas Cerna
  • Date: 2015-07-22 07:11:31 UTC
  • mfrom: (19.1.18 schooltool.isli)
  • Revision ID: douglascerna@yahoo.com-20150722071131-8zmdviiv0fdp90qn
New release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# SchoolTool - common information systems platform for school administration
 
3
# Copyright (c) 2015 Shuttleworth Foundation
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; either version 2 of the License, or
 
8
# (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
#
 
18
"""
 
19
Evolve database to generation 1.
 
20
 
 
21
Adds new student fields
 
22
"""
 
23
 
 
24
from zope.app.generations.utility import getRootFolder
 
25
 
 
26
from schooltool.basicperson.interfaces import IDemographicsFields
 
27
from schooltool.basicperson.demographics import TextFieldDescription
 
28
from schooltool.isli import IsliMessage as _
 
29
 
 
30
 
 
31
def evolve(context):
 
32
    app = getRootFolder(context)
 
33
    dfs = IDemographicsFields(app)
 
34
    if 'mother_name' not in dfs:
 
35
        dfs['mother_name'] = TextFieldDescription(
 
36
            'mother_name', _('Mother name'),
 
37
            limit_keys=['students'])
 
38
    if 'father_name' not in dfs:
 
39
        dfs['father_name'] = TextFieldDescription(
 
40
            'father_name', _('Father name'),
 
41
            limit_keys=['students'])
 
42
    if 'economic_weakness' not in dfs:
 
43
        dfs['economic_weakness'] = TextFieldDescription(
 
44
            'economic_weakness', _('Economic weakness'),
 
45
            limit_keys=['students'])