Changeset 9220 for main/waeup.kofa
- Timestamp:
- 21 Sep 2012, 16:10:59 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py
r9217 r9220 63 63 self.state = context.state 64 64 self.translated_state = context.translated_state 65 try: 66 current_level = course_levels.getTerm( 67 context['studycourse'].current_level).title 68 except LookupError: 69 current_level = None 70 self.current_level = current_level 65 self.current_level = context['studycourse'].current_level 71 66 try: 72 67 current_session = academic_sessions_vocab.getTerm( -
main/waeup.kofa/trunk/src/waeup/kofa/university/course.py
r9217 r9220 21 21 from zope.catalog.interfaces import ICatalog 22 22 from zope.interface import implementedBy 23 from zope.schema import getFields 24 from zope.intid.interfaces import IIntIds 23 25 from zope.component import getUtility 24 26 from zope.component.interfaces import IFactory, ComponentLookupError 27 from waeup.kofa.interfaces import IKofaPluggable 25 28 from waeup.kofa.university.interfaces import ICourse, ICourseAdd 26 29 … … 37 40 credits=0, 38 41 passmark=40, 39 semester=1, **kw): 42 semester=1, 43 former_course=False, 44 **kw): 40 45 super(Course, self).__init__(**kw) 41 46 self.title = title … … 44 49 self.passmark = passmark 45 50 self.semester = semester 51 self.former_course = former_course 46 52 47 53 def longtitle(self): … … 83 89 cert._p_changed = True 84 90 return 91 92 class CoursesPlugin(grok.GlobalUtility): 93 """A plugin that updates courses. 94 """ 95 96 grok.implements(IKofaPluggable) 97 grok.name('courses') 98 99 deprecated_attributes = [] 100 101 def setup(self, site, name, logger): 102 return 103 104 def update(self, site, name, logger): 105 cat = getUtility(ICatalog, name='courses_catalog') 106 results = cat.apply({'code':(None,None)}) 107 uidutil = getUtility(IIntIds, context=cat) 108 items = getFields(ICourse).items() 109 for r in results: 110 o = uidutil.getObject(r) 111 # Add new attributes 112 for i in items: 113 if not hasattr(o,i[0]): 114 setattr(o,i[0],i[1].missing_value) 115 logger.info( 116 'CoursesPlugin: %s attribute %s added.' % ( 117 o.code,i[0])) 118 # Remove deprecated attributes 119 for i in self.deprecated_attributes: 120 try: 121 delattr(o,i) 122 logger.info( 123 'CoursesPlugin: %s attribute %s deleted.' % ( 124 o.code,i)) 125 except AttributeError: 126 pass 127 return -
main/waeup.kofa/trunk/src/waeup/kofa/university/interfaces.py
r9217 r9220 168 168 ) 169 169 170 former_course = schema.Bool( 171 title = _(u'Former Course'), 172 description = _( 173 u'If this attribute is being set all certificate courses ' 174 'referring to this course will be automatically deleted.'), 175 required = False, 176 default = False, 177 ) 178 170 179 def longtitle(): 171 180 """
Note: See TracChangeset for help on using the changeset viewer.