Changeset 5004 for main/waeup.sirp
- Timestamp:
- 4 Feb 2010, 11:53:04 (15 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
r4993 r5004 22 22 SimpleTerm(value, value, title) for title, value in terms]) 23 23 24 25 class CourseSource(BasicSourceFactory):26 """A course source delivers all courses inside the portal by looking27 up a catalog.28 """29 def getValues(self):30 catalog = getUtility(ICatalog, name='courses_catalog')31 return list(catalog.searchResults(code=('', 'z*')))32 33 def getToken(self, value):34 return value.code35 36 def getTitle(self, value):37 return "%s %s" % (value.code, value.title[:32])38 39 40 24 class IWAeUPObject(Interface): 41 25 """A WAeUP object. … … 67 51 """ 68 52 69 class IFaculty(IWAeUPContainer):70 """Representation of a university faculty.71 """72 title = schema.TextLine(73 title = u'Name of Faculty',74 default = u'Unnamed',75 required = True,76 )77 78 title_prefix = schema.TextLine(79 title = u'Title prefix',80 default = u'faculty',81 required = True,82 )83 84 code = schema.TextLine(85 title = u'Code',86 description = u'Abbreviated code of the faculty',87 default = u'NA',88 required = True,89 )90 91 class IFacultyContainer(IWAeUPContainer):92 """A container for faculties.93 """94 def addFaculty(faculty):95 """Add an IFactulty object.96 97 Returns the key, under which the object was stored.98 """99 53 100 54 class IHostelContainer(IWAeUPContainer): … … 116 70 ) 117 71 118 class IDepartment(IWAeUPObject):119 """Representation of a department.120 """121 title = schema.TextLine(122 title = u'Name of Department',123 default = u'Unnamed',124 required = True,125 )126 127 title_prefix = schema.TextLine(128 title = u'Title prefix',129 default = u'department',130 required = True,131 )132 133 code = schema.TextLine(134 title = u'Code',135 default = u'NA',136 description = u'Abbreviated code of the department',137 required = True,138 )139 140 courses = Attribute("A container for courses.")141 certificates = Attribute("A container for certificates.")142 143 144 class ICourseContainer(IWAeUPContainer):145 """A container for faculties.146 """147 def addCourse(faculty):148 """Add an ICourse object.149 150 Returns the key, under which the object was stored.151 """152 153 class ICourse(IWAeUPObject):154 """Representation of a course.155 """156 code = schema.TextLine(157 title = u'Code',158 default = u'NA',159 description = u'Abbreviated code of the course',160 required = True,161 readonly = True,162 )163 164 title = schema.TextLine(165 title = u'Title of course',166 default = u'Unnamed',167 required = True,168 )169 170 level = schema.TextLine(171 title = u'Level',172 default = u'100',173 required = False,174 )175 176 credits = schema.Int(177 title = u'Credits',178 default = 0,179 required = False,180 )181 182 passmark = schema.Int(183 title = u'Passmark',184 default = 40,185 required = False,186 )187 188 semester = schema.Choice(189 title = u'Semester/Term',190 default = 0,191 vocabulary = SimpleWAeUPVocabulary(192 ('N/A', 0), ('First Semester', 1),193 ('Second Semester', 2), ('Combined', 3)),194 required = True,195 )196 197 198 class ICertificate(IWAeUPObject):199 """Representation of a certificate.200 """201 code = schema.TextLine(202 title = u'Code',203 default = u'NA',204 description = u'Abbreviated code of the certificate.',205 required = True,206 )207 208 review_state = schema.Choice(209 title = u'review state',210 default = 'unchecked',211 values = ['unchecked', 'checked']212 )213 214 title = schema.TextLine(215 title = u'title',216 required = True,217 )218 219 study_mode = schema.TextLine(220 title = u'study mode',221 required = True,222 )223 224 start_level = schema.TextLine(225 title = u'start level',226 required = True,227 )228 229 end_level = schema.TextLine(230 title = u'end level',231 required = True,232 )233 234 application_category = schema.TextLine(235 title = u'application category',236 required = False,237 )238 239 max_pass = schema.TextLine(240 title = u'maximum pass',241 required = False,242 )243 244 245 246 class ICertificateContainer(IWAeUPContainer):247 """A container for certificates.248 """249 def addCertificate(faculty):250 """Add an ICertificate object.251 252 Returns the key, under which the object was stored.253 """254 255 class ICertificateCourse(IWAeUPObject):256 """A certificatecourse is a course referenced by a certificate, which257 provides some own attributes.258 """259 course = schema.Choice(260 title = u'Course',261 source = CourseSource(),262 )263 264 level = schema.Int(265 title = u'Level of this course',266 required = True,267 default = 100268 )269 270 core_or_elective = schema.Bool(271 title = u'Is mandatory course (not elective)',272 required = True,273 default = True274 )275 276 def getCourseCode():277 """Return the code of the referenced course.278 279 This is needed for cataloging.280 """281 72 282 73 class IWAeUPExporter(Interface):
Note: See TracChangeset for help on using the changeset viewer.