Ignore:
Timestamp:
25 Jun 2018, 13:30:41 (7 years ago)
Author:
Henrik Bettermann
Message:

Catch AttributeError?. handle_certificate_removed does only clear studycourses with certificate code 'studycourse' but not 'studycourse_1' or 'studycourse_2'.These certificates do still exist but have no parents.

File:
1 edited

Legend:

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

    r15055 r15063  
    932932    @property
    933933    def department(self):
    934         if self.context.certificate is not None:
    935             return self.context.certificate.__parent__.__parent__
     934        try:
     935            if self.context.certificate is not None:
     936                return self.context.certificate.__parent__.__parent__
     937        except AttributeError:
     938            # handle_certificate_removed does only clear
     939            # studycourses with certificate code 'studycourse' but not
     940            # 'studycourse_1' or 'studycourse_2'.These certificates do
     941            # still exist but have no parents.
     942            pass
    936943        return
    937944
    938945    @property
    939946    def faculty(self):
    940         if self.context.certificate is not None:
    941             return self.context.certificate.__parent__.__parent__.__parent__
     947        try:
     948            if self.context.certificate is not None:
     949                return self.context.certificate.__parent__.__parent__.__parent__
     950        except AttributeError:
     951            # handle_certificate_removed does only clear
     952            # studycourses with certificate code 'studycourse' but not
     953            # 'studycourse_1' or 'studycourse_2'.These certificates do
     954            # still exist but have no parents.
     955            pass
    942956        return
    943957
Note: See TracChangeset for help on using the changeset viewer.