- Timestamp:
- 20 Sep 2012, 08:49:37 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/students/student.py
r8737 r9209 28 28 from zope.interface import implementedBy 29 29 from zope.securitypolicy.interfaces import IPrincipalRoleManager 30 from zope.schema.interfaces import ConstraintNotSatisfied 30 31 31 32 from waeup.kofa.image import KofaImageFile … … 130 131 131 132 @property 133 def current_level(self): 134 level = getattr( 135 self.get('studycourse', None), 'current_level', None) 136 return level 137 138 @property 139 def current_verdict(self): 140 level = getattr( 141 self.get('studycourse', None), 'current_verdict', None) 142 return level 143 144 @property 132 145 def current_mode(self): 133 146 certificate = getattr( … … 142 155 self.get('studycourse', None), 'is_postgrad', False) 143 156 return is_postgrad 157 158 def transfer(self, certificate, current_session=None, 159 current_level=None, current_verdict=None, previous_verdict=None): 160 """ Creates a new studycourse and backups the old one. 161 162 """ 163 studycourse = createObject(u'waeup.StudentStudyCourse') 164 try: 165 studycourse.certificate = certificate 166 studycourse.entry_mode = 'transfer' 167 studycourse.current_session = current_session 168 studycourse.current_level = current_level 169 studycourse.current_verdict = current_verdict 170 studycourse.previous_verdict = previous_verdict 171 except ConstraintNotSatisfied: 172 return -1 173 old = self['studycourse'] 174 if getattr(old, 'entry_session', None) is None or\ 175 getattr(old, 'certificate', None) is None: 176 return -2 177 studycourse.entry_session = old.entry_session 178 # Students can be transferred only two times. 179 if 'studycourse_1' in self.keys(): 180 if 'studycourse_2' in self.keys(): 181 return -3 182 self['studycourse_2'] = old 183 else: 184 self['studycourse_1'] = old 185 del self['studycourse'] 186 self['studycourse'] = studycourse 187 self.__parent__.logger.info( 188 '%s - transferred from %s to %s' % ( 189 self.student_id, old.certificate.code, studycourse.certificate.code)) 190 history = IObjectHistory(self) 191 history.addMessage('Transferred from %s to %s' % ( 192 old.certificate.code, studycourse.certificate.code)) 193 return 144 194 145 195
Note: See TracChangeset for help on using the changeset viewer.