Ignore:
Timestamp:
16 Jan 2020, 11:04:43 (5 years ago)
Author:
Henrik Bettermann
Message:

Reset _curr_stud_id if student could not be created.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py

    r15930 r15932  
    156156        and copy applicant data.
    157157        """
     158        site = grok.getSite()
    158159        # Is applicant in the correct state?
    159160        if self.state != 'admitted':
     
    164165            student.reg_number = self.reg_number
    165166        except RegNumNotInSource:
     167            # Reset _curr_stud_id
     168            site['students']._curr_stud_id -= 1
    166169            return False, _('Registration Number exists.')
    167170        # Has the course_admitted field been properly filled?
    168171        if self.course_admitted is None:
     172            # Reset _curr_stud_id
     173            site['students']._curr_stud_id -= 1
    169174            return False, _('No course admitted provided.')
    170175        # Set student attributes
     
    173178                setattr(student, item[1], getattr(self, item[0], None))
    174179        except RequiredMissing, err:
     180            site['students']._curr_stud_id -= 1
    175181            return False, 'RequiredMissing: %s' % err
    176182        except:
     183            site['students']._curr_stud_id -= 1
    177184            return False, 'Unknown Error'
    178185        # Prove if the certificate still exists
     
    180187            StudentStudyCourse().certificate = self.course_admitted
    181188        except ConstraintNotSatisfied, err:
     189            # Reset _curr_stud_id
     190            site['students']._curr_stud_id -= 1
    182191            return False, 'ConstraintNotSatisfied: %s' % self.course_admitted.code
    183192        # Finally prove if an application slip can be created
     
    186195                view=view)
    187196        except IOError:
     197            site['students']._curr_stud_id -= 1
    188198            return False, _('IOError: Application Slip could not be created.')
    189199        except LayoutError, err:
     200            site['students']._curr_stud_id -= 1
    190201            return False, _('Reportlab LayoutError: %s' % err)
    191202        except AttributeError, err:
     203            site['students']._curr_stud_id -= 1
    192204            return False, _('Reportlab AttributeError: ${a}', mapping = {'a':err})
    193205        except:
     206            site['students']._curr_stud_id -= 1
    194207            return False, _('Unknown Reportlab error')
    195208        # Add student
    196         site = grok.getSite()
    197209        site['students'].addStudent(student)
    198210        # Save student_id
Note: See TracChangeset for help on using the changeset viewer.