- Timestamp:
- 14 Oct 2014, 10:28:24 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.pcn/trunk/src/kofacustom/pcn/university/faculty.py
r11839 r11840 1 1 import grok 2 from waeup.kofa.university.interfaces import IDepartment, ICertificate 2 from zope import schema 3 from zope.interface import Attribute, invariant, Invalid 4 from waeup.kofa.interfaces import (IKofaObject, IKofaContainer, validate_email) 5 from waeup.kofa.university.interfaces import ICertificate 3 6 from waeup.kofa.university.faculty import ( 4 7 Faculty, FacultyFactory) … … 7 10 from waeup.kofa.university.certificate import ( 8 11 Certificate, CertificateFactory) 12 from waeup.kofa.university.vocabularies import ( 13 course_levels, 14 CourseSource, 15 StudyModeSource, 16 AppCatSource, 17 InstTypeSource, 18 SemesterSource, 19 ) 9 20 21 22 from waeup.kofa.interfaces import MessageFactory as _ 23 24 25 class IFaculty(IKofaContainer): 26 """Representation of a university faculty. 27 """ 28 29 code = schema.TextLine( 30 title = _(u'Code'), 31 default = u'NA', 32 required = True, 33 ) 34 35 title = schema.TextLine( 36 title = _(u'Name of faculty'), 37 default = u'Unnamed', 38 required = True, 39 ) 40 41 title_prefix = schema.Choice( 42 title = _(u'Name prefix'), 43 default = u'faculty', 44 source = InstTypeSource(), 45 required = True, 46 ) 47 48 address = schema.Text( 49 title = _(u'Permanent Address'), 50 required = False, 51 ) 52 53 email = schema.ASCIILine( 54 title = _(u'Email'), 55 required = False, 56 constraint=validate_email, 57 ) 10 58 11 59 class CustomFaculty(Faculty): 12 60 """A university faculty. 13 61 """ 62 grok.implements(IFaculty) 63 14 64 local_roles = [ 15 65 'waeup.local.DepartmentOfficer', 16 66 'waeup.local.DepartmentManager', 17 67 ] 68 69 def __init__(self, 70 title=u'Unnamed Faculty', 71 title_prefix=u'faculty', 72 address=None, 73 email=None, 74 code=u'NA', **kw): 75 super(Faculty, self).__init__(**kw) 76 self.title = title 77 self.title_prefix = title_prefix 78 self.code = code 79 self.address = address 80 self.email = email 18 81 19 82 class CustomFacultyFactory(FacultyFactory): … … 27 90 return implementedBy(CustomFaculty) 28 91 92 class IDepartment(IKofaObject): 93 """Representation of a department. 94 """ 95 code = schema.TextLine( 96 title = _(u'Code'), 97 default = u'NA', 98 required = True, 99 ) 100 101 title = schema.TextLine( 102 title = _(u'Name of department'), 103 default = u'Unnamed', 104 required = True, 105 ) 106 107 title_prefix = schema.Choice( 108 title = _(u'Name prefix'), 109 source = InstTypeSource(), 110 default = u'department', 111 required = True, 112 ) 113 114 address = schema.Text( 115 title = _(u'Permanent Address'), 116 required = False, 117 ) 118 119 email = schema.ASCIILine( 120 title = _(u'Email'), 121 required = False, 122 constraint=validate_email, 123 ) 124 125 certificates = Attribute("A container for certificates.") 126 29 127 class CustomDepartment(Department): 30 128 """A university department. … … 37 135 'waeup.local.DepartmentManager', 38 136 ] 137 138 def __init__(self, 139 title=u'Unnamed Department', 140 title_prefix=u'department', 141 address=None, 142 email=None, 143 code=u"NA", **kw): 144 super(Department, self).__init__(**kw) 145 self.title = title 146 self.title_prefix = title_prefix 147 self.code = code 148 self.courses = CoursesContainer() 149 self.courses.__parent__ = self 150 self.courses.__name__ = 'courses' 151 self.certificates = CertificatesContainer() 152 self.certificates.__parent__ = self 153 self.certificates.__name__ = 'certificates' 154 self.score_editing_disabled = False 155 self.address = address 156 self.email = email 39 157 40 158 class CustomDepartmentFactory(DepartmentFactory):
Note: See TracChangeset for help on using the changeset viewer.