Changeset 14638 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 21 Mar 2017, 10:13:41 (8 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/app.py
r14511 r14638 88 88 getUtility(IKofaPluggable, name='certificates').update( 89 89 self, 'certificates', self.logger) 90 getUtility(IKofaPluggable, name='certcourses').update( 91 self, 'certcourses', self.logger) 90 92 return 91 93 attrs_to_fields(University) -
main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/certificatecoursepage.pt
r10650 r14638 16 16 </tr> 17 17 <tr> 18 <td i18n:translate="">Provided by:</td>18 <td class="fieldname" i18n:translate="">Provided by:</td> 19 19 <td> 20 20 <span tal:content="python: context.course.__parent__.__parent__.longtitle">DEPARTMENT</span> … … 28 28 </tr> 29 29 <tr> 30 <td i18n:translate="">Course Category:</td> 31 <td tal:content="context/course_category">NONE</td> 32 </tr> 33 <tr> 30 34 <td i18n:translate="">Required course:</td> 31 35 <td tal:content="context/mandatory">REQUIRED</td> -
main/waeup.kofa/trunk/src/waeup/kofa/university/certificate.py
r13721 r14638 95 95 return "%s (%s)" % (self.title,self.code) 96 96 97 def addCertCourse(self, course, level=100, mandatory=True): 97 def addCertCourse(self, course, level=100, 98 mandatory=True, course_category=None): 98 99 """Add a certificate course. 99 100 """ 100 101 code = "%s_%s" % (course.code, level) 101 self[code] = CertificateCourse(course, level, mandatory )102 self[code] = CertificateCourse(course, level, mandatory, course_category) 102 103 self[code].__parent__ = self 103 104 self[code].__name__ = code … … 156 157 grok.implements(ICertificateCourse) 157 158 158 def __init__(self, course=None, level=100, mandatory=True): 159 def __init__(self, course=None, level=100, 160 mandatory=True, course_category=None): 159 161 self.course = course 160 162 self.level = level 161 163 self.mandatory = mandatory 164 self.course_category = course_category 162 165 163 166 def getCourseCode(self): … … 249 252 pass 250 253 return 254 255 class CertificateCoursesPlugin(grok.GlobalUtility): 256 """A plugin that updates certificate courses. 257 """ 258 259 grok.implements(IKofaPluggable) 260 grok.name('certcourses') 261 262 deprecated_attributes = [] 263 264 def setup(self, site, name, logger): 265 return 266 267 def update(self, site, name, logger): 268 cat = getUtility(ICatalog, name='certcourses_catalog') 269 results = cat.apply({'course_code':(None,None)}) 270 uidutil = getUtility(IIntIds, context=cat) 271 items = getFields(ICertificateCourse).items() 272 for r in results: 273 o = uidutil.getObject(r) 274 # Add new attributes 275 for i in items: 276 if not hasattr(o,i[0]): 277 setattr(o,i[0],i[1].missing_value) 278 # Remove deprecated attributes 279 for i in self.deprecated_attributes: 280 try: 281 delattr(o,i) 282 except AttributeError: 283 pass 284 return -
main/waeup.kofa/trunk/src/waeup/kofa/university/interfaces.py
r14511 r14638 31 31 SemesterSource, 32 32 DegreeSource, 33 CourseCategorySource 33 34 ) 34 35 … … 329 330 ) 330 331 332 course_category = schema.Choice( 333 title = _(u'Course Category'), 334 source = CourseCategorySource(), 335 required = False, 336 ) 337 331 338 mandatory = schema.Bool( 332 339 title = _(u'Registration required'), -
main/waeup.kofa/trunk/src/waeup/kofa/university/vocabularies.py
r13617 r14638 94 94 return "%s - %s" % (value.code, value.title[:64]) 95 95 96 class CourseCategorySource(ContextualDictSourceFactoryBase): 97 """A course category source provides additional information on 98 the course. 99 """ 100 #: name of dict to deliver from kofa utils. 101 DICT_NAME = 'COURSE_CATEGORY_DICT' 96 102 97 103 -
main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
r14473 r14638 158 158 } 159 159 160 COURSE_CATEGORY_DICT = { 161 } 162 160 163 SPECIAL_HANDLING_DICT = { 161 164 'regular': 'Regular Hostel',
Note: See TracChangeset for help on using the changeset viewer.