예제 #1
0
    def get(self):  #when the user accidentally enters this url
        user = users.get_current_user()  # get current user connection status
        result = checks.recognize_person(user.email())
        if result == 3:  # a dog walker entered dog owner zone
            return self.redirect(
                '/walker/profile')  #redirect dog walker to his profile page

        return self.redirect(
            '/owner/profile/filter')  #else, return to the filter page.
예제 #2
0
    def get(self):
        user = users.get_current_user()  # get current user connection status
        result = checks.recognize_person(user.email())
        if result == 3:  # a dog walker entered dog owner zone
            return self.redirect(
                '/walker/profile')  #redirect dog walker to his profile page

        #prepare the relevant web page
        template = jinja_environment.get_template('/add_a_dog.html')
        data = {'species': profile.show_species()}
        self.response.write(template.render(data))
예제 #3
0
    def get(self):
        user = users.get_current_user()  # get current user connection status
        result = checks.recognize_person(user.email())
        if result == 1 or result == 2:  # a dog owner entered dog owner zone
            return self.redirect(
                '/owner/profile')  #redirect dog owner to his profile page
        elif result == 0:
            return self.redirect(
                '/')  #in case the person does not exist in database

        data = profile.walker_main_page(
            user.email())  #prepare the data for the dog walker profile
        template = jinja_environment.get_template('profile_dogwalker.html')
        self.response.write(template.render(data))
예제 #4
0
    def get(self):  #when the dog owner wants to view all his unregistered dogs
        user = users.get_current_user()  # get current user connection status
        result = checks.recognize_person(user.email())
        if result == 3:  # a dog walker entered dog owner zone
            return self.redirect(
                '/walker/profile')  #redirect dog walker to his profile page

        ### Receive the unregistered dogs along with the available cities
        template = jinja_environment.get_template('filter.html')
        data = {
            'dogs_unregistered': profile.getUnregisteredDogs(user.email()),
            'cities': profile.getCities()
        }
        logging.info(str(data['dogs_unregistered']))
        self.response.write(template.render(data))
예제 #5
0
    def get(self):
        user = users.get_current_user()  # get current user connection status
        if not user:
            return self.redirect(users.create_login_url(dest_url='/login'))

        result = checks.recognize_person(user.email())
        #################################################################
        ### if result is 0, then the person isn't registered in database.
        ### if result is 1, then the person is a regular dog owner.
        ### if result is 2, then the person is a premium dog owner.
        ### if result is 3, then the person is a dog walker.
        #################################################################
        if result == 0:
            template = jinja_environment.get_template(
                'choose_register.html')  #show the registeration selection page
            return self.response.write(template.render())
        elif result == 1 or result == 2:
            self.redirect('/owner/profile')
        elif result == 3:
            self.redirect('/walker/profile')
예제 #6
0
    def get(self):
        user = users.get_current_user()  # get current user connection status
        result = checks.recognize_person(user.email())
        if result == 3:  # a dog walker entered dog owner zone
            return self.redirect(
                '/walker/profile')  #redirect dog walker to his profile page

        data_from_db = profile.getRelevantDogWalkers(user.email())
        data = {
            'dog_walkers': data_from_db[0],  #retrieve assigned dog walkers
            'total_cost': data_from_db[1],  #retrieve total cost of dog owner
            'row_count': data_from_db[
                2],  #retrieve number of rows received by query --> number of assigned dog walkers
            'days': profile.days
        }
        logging.info(str(data))

        ### PREPARE RESPONSE ###
        template = jinja_environment.get_template(
            'dog_owner_relevant_dogwalkers.html')
        self.response.write(template.render(data))