student_register.py
def post(self):
        """
        Handles student registration requests, which come in the form of POST requests submitted via the form
        that is generated in GET requests
        Input: self
        Output: a rendering of the student register page: with a success message and link to the student
                dashboard if everything went well, or with an error message if there was a problem
        """
        # Get the database objects we will need
        students = gbmodel.students()
        teams = gbmodel.teams()

        # Continue processing the POST request
        try:
            # Get the student_id and information the student submitted via the form
            student_id = CAS().username
            name = request.form.getlist('name')[0]
            email_address = request.form.getlist('email_address')[0]
            session_id = request.form.getlist('session_id')[0]

            # Verify that the student isn't already registered for the target session
            if students.get_student_in_session(student_id, session_id) is not None:
                logging.warning(("A student tried to register for a Capstone session, but the student was "
                                 "already registered for the session"))
                return self.display_error("You are already in this session")

            # Add the student to the database
            # The student won't be on a team when they first sign up, so we have to assign them to the
            # empty team for the target session. We start by checking if the empty team exists. If the
            # target session doesn't have one yet, we create it
            if teams.get_tid_from_name("", session_id) is None:
                teams.insert_team(session_id, "")

            # Insert the student into the database (as a part of the empty team)
            students.insert_student(name, email_address, student_id, session_id, "")

            # Log the event and render the page with a message telling the student that they have been
            # registered (along with a link to the student page)
            logging.info("A student registered for a Capstone session")
            return render_template('studentRegister.html', message="Successfully registered!", is_error=False)

        # https://stackoverflow.com/questions/47719838/how-to-catch-all-exceptions-in-try-catch-block-python
        except Exception as error:
            logging.error("Student Registration Failure: " + str(error))
            return self.display_error("Something went wrong")

        Handles student registration requests, which come in the form of POST requests submitted via the form
        that is generated in GET requests
        Input: self
        Output: a rendering of the student register page: with a success message and link to the student
                dashboard if everything went well, or with an error message if there was a problem
        
Handles student registration requests, which come in the form of POST requests submitted via the form
that is generated in GET requests
Input: self
Output: a rendering of the student register page: with a success message and link to the student
dashboard if everything went well, or with an error message if there was a problem
Handles student registration requests which come in the form of POST requests submitted via the form that is generated in GET requests Input : self Output : a rendering of the student register page : with a success message and link to the student dashboard if everything went well or with an error message if there was a problem
def post(self):
        students = gbmodel.students()
        teams = gbmodel.teams()
        try:
            student_id = CAS().username
            name = request.form.getlist('name')[0]
            email_address = request.form.getlist('email_address')[0]
            session_id = request.form.getlist('session_id')[0]
            if students.get_student_in_session(student_id, session_id) is not None:
                logging.warning(("A student tried to register for a Capstone session, but the student was "
                                 "already registered for the session"))
                return self.display_error("You are already in this session")
            if teams.get_tid_from_name("", session_id) is None:
                teams.insert_team(session_id, "")
            students.insert_student(name, email_address, student_id, session_id, "")
            logging.info("A student registered for a Capstone session")
            return render_template('studentRegister.html', message="Successfully registered!", is_error=False)
        except Exception as error:
            logging.error("Student Registration Failure: " + str(error))
            return self.display_error("Something went wrong")
def post ( self ) : students = gbmodel . students ( ) teams = gbmodel . teams ( ) try : student_id = CAS ( ) . username name = request . form . getlist ( 'name' ) [ 0 ] email_address = request . form . getlist ( 'email_address' ) [ 0 ] session_id = request . form . getlist ( 'session_id' ) [ 0 ] if students . get_student_in_session ( student_id , session_id ) is not None : logging . warning ( ( "A student tried to register for a Capstone session, but the student was " "already registered for the session" ) ) return self . display_error ( "You are already in this session" ) if teams . get_tid_from_name ( "" , session_id ) is None : teams . insert_team ( session_id , "" ) students . insert_student ( name , email_address , student_id , session_id , "" ) logging . info ( "A student registered for a Capstone session" ) return render_template ( 'studentRegister.html' , message = "Successfully registered!" , is_error = False ) except Exception as error : logging . error ( "Student Registration Failure: " + str ( error ) ) return self . display_error ( "Something went wrong" )
Handles student registration requests, which come in the form of POST requests submitted via the form
that is generated in GET requests
Input: self
Output: a rendering of the student register page: with a success message and link to the student
dashboard if everything went well, or with an error message if there was a problem
Handles student registration requests which come in the form of POST requests submitted via the form that is generated in GET requests Input : self Output : a rendering of the student register page : with a success message and link to the student dashboard if everything went well or with an error message if there was a problem
"""
        Handles student registration requests, which come in the form of POST requests submitted via the form
        that is generated in GET requests
        Input: self
        Output: a rendering of the student register page: with a success message and link to the student
                dashboard if everything went well, or with an error message if there was a problem
        """ # Get the database objects we will need # Continue processing the POST request # Get the student_id and information the student submitted via the form # Verify that the student isn't already registered for the target session # Add the student to the database # The student won't be on a team when they first sign up, so we have to assign them to the # empty team for the target session. We start by checking if the empty team exists. If the # target session doesn't have one yet, we create it # Insert the student into the database (as a part of the empty team) # Log the event and render the page with a message telling the student that they have been # registered (along with a link to the student page) # https://stackoverflow.com/questions/47719838/how-to-catch-all-exceptions-in-try-catch-block-python
self