Changeset 8338 for main/waeup.kofa/trunk


Ignore:
Timestamp:
4 May 2012, 10:46:23 (13 years ago)
Author:
uli
Message:

Make study levels more robust.

File:
1 edited

Legend:

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

    r8330 r8338  
    9999
    100100    def getStudent(self):
    101         return self.__parent__.__parent__.__parent__
     101        """Get the associated student object.
     102        """
     103        # XXX: shouldn't that be an attribute?
     104        try:
     105            return self.__parent__.__parent__.__parent__
     106        except AttributeError:
     107            return None
    102108
    103109    def getLevel(self):
    104110        """Returns the id of the level the ticket has been added to.
    105111        """
    106         return self.__parent__.level
     112        # XXX: shouldn't that be an attribute?
     113        try:
     114            return self.__parent__.level
     115        except AttributeError:
     116            return None
    107117
    108118    def getLevelSession(self):
    109119        """Returns the session of the level the ticket has been added to.
    110120        """
    111         return self.__parent__.level_session
     121        # XXX: shouldn't that be an attribute?
     122        try:
     123            return self.__parent__.level_session
     124        except AttributeError:
     125            return None
    112126
    113127
Note: See TracChangeset for help on using the changeset viewer.