Ignore:
Timestamp:
30 Jan 2013, 09:08:39 (12 years ago)
Author:
Henrik Bettermann
Message:

Convert getLevel and getLevelSession into property attributes.

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

Legend:

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

    r9924 r9925  
    160160    view.context.writeLogMessage(
    161161        view,'added: %s|%s|%s' % (
    162         ticket.code, ticket.getLevel(), ticket.getLevelSession()))
     162        ticket.code, ticket.level, ticket.level_session))
    163163    return True
    164164
  • main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py

    r9843 r9925  
    131131    grok.context(ICourseTicket)
    132132
    133     level = index.Field(attribute='getLevel')
    134     session = index.Field(attribute='getLevelSession')
     133    level = index.Field(attribute='level')
     134    session = index.Field(attribute='level_session')
    135135    code = index.Field(attribute='code')
    136136
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r9859 r9925  
    265265                value = getattr(student, name, None)
    266266            if name == 'level':
    267                 value = getattr(context, 'getLevel', lambda: None)()
     267                value = getattr(context, 'level', lambda: None)
    268268            if name == 'level_session':
    269                 value = getattr(context, 'getLevelSession', lambda: None)()
     269                value = getattr(context, 'level_session', lambda: None)
    270270        return super(
    271271            CourseTicketExporter, self).mangle_value(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r9874 r9925  
    559559    weight = Attribute('weight calculated from score')
    560560    removable_by_student = Attribute('Is student allowed to remove the ticket?')
     561    level_session = Attribute('session of the level the ticket has been added to')
     562    level = Attribute('id of the level the ticket has been added to')
    561563
    562564    title = schema.TextLine(
     
    615617        )
    616618
    617     def getLevel():
    618         """Returns the id of the level the ticket has been added to.
    619         """
    620 
    621     def getLevelSession():
    622         """Returns the session of the level the ticket has been added to.
    623         """
    624619
    625620class ICourseTicketAdd(IKofaObject):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r9912 r9925  
    203203        return self.__parent__.__parent__.__parent__.writeLogMessage(view, message)
    204204
    205     def getLevel(self):
     205    @property
     206    def level(self):
    206207        """Returns the id of the level the ticket has been added to.
    207208        """
    208         # XXX: shouldn't that be an attribute?
    209209        try:
    210210            return self.__parent__.level
     
    212212            return None
    213213
    214     def getLevelSession(self):
     214    @property
     215    def level_session(self):
    215216        """Returns the session of the level the ticket has been added to.
    216217        """
    217         # XXX: shouldn't that be an attribute?
    218218        try:
    219219            return self.__parent__.level_session
Note: See TracChangeset for help on using the changeset viewer.