Ignore:
Timestamp:
11 Apr 2012, 07:42:13 (13 years ago)
Author:
Henrik Bettermann
Message:

Define separator headlines on clearance forms.

Catch ConstraintNotSatisfied? exception if selected level is wrong.

File:
1 edited

Legend:

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

    r8082 r8099  
    2727from zope.catalog.interfaces import ICatalog
    2828from zope.component import queryUtility, getUtility, createObject
     29from zope.schema.interfaces import ConstraintNotSatisfied
    2930from zope.formlib.textwidgets import BytesDisplayWidget
    3031from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
     
    407408
    408409    @property
     410    def separators(self):
     411        return getUtility(IStudentsUtils).SEPARATORS_DICT
     412
     413    @property
    409414    def form_fields(self):
    410415        cm = getattr(self.context,'current_mode', None)
     
    469474    label = _('Manage clearance data')
    470475    pnav = 4
     476
     477    @property
     478    def separators(self):
     479        return getUtility(IStudentsUtils).SEPARATORS_DICT
    471480
    472481    @property
     
    634643    @action(_('Save'), style='primary')
    635644    def save(self, **data):
    636         msave(self, **data)
     645        try:
     646            msave(self, **data)
     647        except ConstraintNotSatisfied:
     648            # The selected level might not exist in certificate
     649            self.flash(_('Current level not available for certificate.'))
     650            return
    637651        notify(grok.ObjectModifiedEvent(self.context.__parent__))
    638652        return
Note: See TracChangeset for help on using the changeset viewer.