/usr/share/pyshared/schooltool/basicperson/interfaces.py is in python-schooltool 1:2.1.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | #
# SchoolTool - common information systems platform for school administration
# Copyright (c) 2007 Shuttleworth Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
SchoolTool basic person interfaces.
"""
from zope.container.interfaces import IContainer
from zope.container.interfaces import IOrderedContainer
from zope.schema import Date, Choice, TextLine, Bool, List, Int
from zope.configuration.fields import PythonIdentifier
from zope.interface import Interface, Attribute
from zope.schema.interfaces import IVocabularyTokenized
from schooltool.app.utils import vocabulary
from schooltool.common import SchoolToolMessage as _
class IBasicPerson(Interface):
"""Marker interface for a basic person."""
prefix = TextLine(
title=_(u"Prefix"),
required=False,
)
first_name = TextLine(
title=_(u"First name"),
required=True,
)
middle_name = TextLine(
title=_(u"Middle name"),
required=False,
)
last_name = TextLine(
title=_(u"Last name"),
required=True,
)
suffix = TextLine(
title=_(u"Suffix"),
required=False,
)
preferred_name = TextLine(
title=_(u"Preferred name"),
required=False,
)
gender = Choice(
title=_(u"Gender"),
vocabulary=vocabulary([('male', _('Male')), ('female', _('Female')),]),
required=False,
)
birth_date = Date(
title=_(u"Birth date"),
description=_(u"(yyyy-mm-dd)"),
required=False,
)
advisors = Attribute("""Advisors of the person""")
advisees = Attribute("""Advisees of the person""")
class IBasicPersonVocabulary(IVocabularyTokenized):
"""Marker interface for vocabularies that list basic persons."""
# XXX should be in skin or common, or more properly - core
class IGroupVocabulary(IVocabularyTokenized):
"""Marker interface for vocabularies that list schooltool groups."""
class IAdvisor(Interface):
students = Attribute("""Students being advised by the advisor.""")
def addStudent(student):
"""Add a student to the advised students list."""
def removeStudent(student):
"""Remove this student from the advised students list."""
class IDemographics(IContainer):
"""Demographics data storage for a person.
Stores any kind of data defined by field descriptions that are set
up for the person container.
"""
class IDemographicsFields(IOrderedContainer):
"""Demographics field storage."""
def filter_key(key):
"""Return the subset of fields whose limited_keys list is either
empty, or it contains the key passed"""
def filter_keys(keys):
"""Return the subset of fields whose limited_keys list is either
empty, or it contains one of the keys passed"""
class FilterKeyList(List):
"""Marker field to pin widgets on."""
class IFieldDescription(Interface):
"""Demographics field."""
title = TextLine(
title = _(u"Title"),
description = _(u"As it should appear on forms and reports."))
name = PythonIdentifier(
title = _(u"ID"),
description = _(u"A unique one word alphanumeric identifier."))
required = Bool(
title = _(u"Required"))
limit_keys = FilterKeyList(
title = _(u"Limit to group(s)"),
description = _(u"If you select one or more groups below, this field "
"will only be displayed in forms and reports for "
"members of the selected groups."),
value_type=Choice(
source="schooltool.basicperson.limit_keys_vocabulary",
required=True,
),
required=False)
class EnumValueList(List):
"""Marker field to pin custom validation on."""
class IEnumFieldDescription(IFieldDescription):
"""Enumeration demographics field."""
items = EnumValueList(
title = _('Selection list'),
description = _(u"Enter the valid values for the field below. One "
"value per line. These values will be displayed "
"as a menu in forms."))
class IIntFieldDescription(IFieldDescription):
"""Integer demographics field."""
min_value = Int(
title=_(u'Minimum value'),
required=False)
max_value = Int(
title=_(u'Maximum value'),
required=False)
class IFieldFilterVocabulary(IVocabularyTokenized):
"""Marker interface for vocabularies that give keys that are used
to filter demographics fields for the context.
"""
class IAddEditViewTitle(Interface):
"""Demographics field add/edit view title."""
class ILimitKeysLabel(Interface):
"""Demographics field add/edit view limit keys label text."""
class ILimitKeysHint(Interface):
"""Demographics field add/edit view limit keys hint text."""
|