Changeset 8323 for main/waeup.kofa/trunk


Ignore:
Timestamp:
2 May 2012, 08:17:14 (13 years ago)
Author:
Henrik Bettermann
Message:

We need to customize StudentStudyCourse? and StudentStudyLevel?. Therefore it's better to use the factory utility.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8322 r8323  
    658658    def addStudyLevel(self, **data):
    659659        level_code = self.request.form.get('addlevel', None)
    660         studylevel = StudentStudyLevel()
     660        studylevel = createObject(u'waeup.StudentStudyLevel')
    661661        studylevel.level = int(level_code)
    662662        try:
     
    17241724    def update(self, SUBMIT=None):
    17251725        if not self.context.getStudent().state in (CLEARED,RETURNING):
    1726             self.flash(_("Wrong state"))
     1726            self.flash(_("You are in wrong state."))
     1727            self.redirect(self.url(self.context))
     1728            return
     1729        if not self.context.may_register:
     1730            self.flash(_("You are not entitled to start course registration."))
    17271731            self.redirect(self.url(self.context))
    17281732            return
     
    17861790    @action(_('Create course list now'), style='primary')
    17871791    def addStudyLevel(self, **data):
    1788         studylevel = StudentStudyLevel()
     1792        studylevel = createObject(u'waeup.StudentStudyLevel')
    17891793        studylevel.level = self.context.current_level
    17901794        studylevel.level_session = self.context.current_session
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r8287 r8323  
    2222import grok
    2323from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo
    24 from zope.component import getUtility
     24from zope.component import getUtility, createObject
    2525from zope.component.interfaces import IFactory
    2626from zope.interface import implementedBy
     
    161161    else:
    162162        student.clearance_locked = True
    163     studycourse = StudentStudyCourse()
     163    studycourse = createObject(u'waeup.StudentStudyCourse')
    164164    student['studycourse'] = studycourse
    165165    payments = StudentPaymentsContainer()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py

    r8141 r8323  
    4040    def getStudent(self):
    4141        return self.__parent__
     42
     43    @property
     44    def may_register(self):
     45        return True
    4246
    4347    def addStudentStudyLevel(self, cert, studylevel):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r8262 r8323  
    444444    @property
    445445    def target_url(self):
    446         if not self.context.getStudent().state in (CLEARED,RETURNING):
     446        if not self.context.getStudent().state in (CLEARED,RETURNING) \
     447            or not self.context.may_register:
    447448            return ''
    448449        return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.