示例#1
0
 def get(self):
     user = users.get_current_user()
     p_obj = permissions.Permissions()
     userTypes = p_obj.getPermissions(user.email())
     if userTypes[1] == 1:
         self.redirect('/owner-home')
         return
     template = jinja_environment.get_template('register_owner.html')
     cities_obj = Cities()
     my_cities = cities_obj.getCitiesFromDb()
     parameters_for_template = {'user': user, 'cities': my_cities}
     self.response.write(template.render(parameters_for_template))
示例#2
0
    def get(self):
        my_dog_finder = dog_finder.DogFinder()
        user = users.get_current_user()
        dogs = my_dog_finder.getAllDogs(user.email())
        p_obj = permissions.Permissions()
        userTypes = p_obj.getPermissions(user.email())
        if userTypes[1] != 1:
            parameters_for_template = {
                'message':
                'You don\'t have permissions to this page. Please try again later'
            }
            template = jinja_environment.get_template('error_page.html')
            self.response.write(template.render(parameters_for_template))
        if len(dogs) == 0:
            parameters_for_template = {
                'message':
                'You have to add dogs before scheduling a walker. Go back and try again.'
            }
            template = jinja_environment.get_template('error_page.html')
            self.response.write(template.render(parameters_for_template))
        else:
            weekDays = [
                self.request.get('su'),
                self.request.get('mo'),
                self.request.get('tu'),
                self.request.get('we'),
                self.request.get('th'),
                self.request.get('fr'),
                self.request.get('sa')
            ]
            logging.error(self.request.get('startDate'))
            startDate = self.request.get('startDate')
            endDate = self.request.get('endDate')
            dog_id = self.request.get('dog')

            my_walker_finder = walker_finder.WalkerFinder()
            walkers = my_walker_finder.getAllWalkers(weekDays, startDate,
                                                     endDate, dog_id,
                                                     user.email())
            logging.error(walkers)
            parameters_for_template = {
                'user': user,
                'dogs': dogs,
                "dates": walkers,
                "dogID": dog_id
            }
            template = jinja_environment.get_template('filter_walkers.html')
            self.response.write(template.render(parameters_for_template))
示例#3
0
    def get(self):
        user = users.get_current_user()
        if user:
            p_obj = permissions.Permissions()
            userTypes = p_obj.getPermissions(user.email())

            if userTypes[0] == 1 and userTypes[1] == 1:
                logging.error(userTypes[1])
                logging.error(userTypes[1])
                self.redirect('/walker-home')
            elif userTypes[0] == 1 and userTypes[1] == 0:
                logging.error('in walker')
                self.redirect('/walker-home')
            elif userTypes[0] == 0 and userTypes[1] == 1:
                logging.error('in walker')
                self.redirect('/owner-home')
            else:
                logging.error(userTypes[0])
                self.redirect('/register')
        else:
            self.redirect('/splash-screen')
示例#4
0
 def get(self):
     my_dog_finder = dog_finder.DogFinder()
     user = users.get_current_user()
     dogs = my_dog_finder.getAllDogs(user.email())
     p_obj = permissions.Permissions()
     userTypes = p_obj.getPermissions(user.email())
     if userTypes[1] != 1:
         parameters_for_template = {
             'message':
             'You don\'t have permissions to this page. Please try again later'
         }
         template = jinja_environment.get_template('error_page.html')
         self.response.write(template.render(parameters_for_template))
     else:
         parameters_for_template = {
             'user': user,
             'dogs': dogs,
             'walkers': {},
             "dogID": ""
         }
         template = jinja_environment.get_template('filter_walkers.html')
         self.response.write(template.render(parameters_for_template))
示例#5
0
 def get(self):
     user = users.get_current_user()
     p_obj = permissions.Permissions()
     userTypes = p_obj.getPermissions(user.email())
     if userTypes[0] != 1:  #UPDATE TO CHECK IN DB
         parameters_for_template = {
             'message':
             'You don\'t have permissions to this page. Please try again later'
         }
         template = jinja_environment.get_template('error_page.html')
         self.response.write(template.render(parameters_for_template))
     else:
         cities_obj = Cities()
         my_owner_finder = owner_finder.OwnerFinder()
         my_cities = cities_obj.getCitiesFromDb()
         owners = my_owner_finder.getAllOwners('', 0, 0, user.email(), True)
         parameters_for_template = {
             'user': user,
             'cities': my_cities,
             'owners': owners
         }
         template = jinja_environment.get_template('filter_owners.html')
         self.response.write(template.render(parameters_for_template))
示例#6
0
 def get(self):
     my_trip_finder = trip_finder.TripFinder()
     user = users.get_current_user()
     trips = my_trip_finder.getAllTrips(user.email())
     p_obj = permissions.Permissions()
     userTypes = p_obj.getPermissions(user.email())
     if userTypes[0] != 1:
         parameters_for_template = {
             'message':
             'You don\'t have permissions to this page. Please try again later'
         }
         template = jinja_environment.get_template('error_page.html')
         self.response.write(template.render(parameters_for_template))
     if len(trips) == 0:
         parameters_for_template = {
             'message': 'Oops! You dont have any trips yet!'
         }
         template = jinja_environment.get_template('error_page.html')
         self.response.write(template.render(parameters_for_template))
     else:
         parameters_for_template = {'user': user, 'trips': trips}
         template = jinja_environment.get_template('my_trips.html')
         self.response.write(template.render(parameters_for_template))
示例#7
0
    def get(self):
        user = users.get_current_user()
        p_obj = permissions.Permissions()
        userTypes = p_obj.getPermissions(user.email())
        if userTypes[0] != 1:
            parameters_for_template = {
                'message':
                'You don\'t have permissions to this page. Please try again later'
            }
            template = jinja_environment.get_template('error_page.html')
            self.response.write(template.render(parameters_for_template))
        else:
            city = self.request.get('city')
            minAge = self.request.get('minAge')
            maxAge = self.request.get('maxAge')
            viewAll = True if self.request.get('all') == 'on' else False
            logging.error(viewAll)
            my_owner_finder = owner_finder.OwnerFinder()
            if viewAll:
                owners = my_owner_finder.getAllOwners('', 0, 0, user.email(),
                                                      viewAll)
            else:
                owners = my_owner_finder.getAllOwners(city, minAge, maxAge,
                                                      user.email(), viewAll)

        logging.error(owners)
        cities_obj = Cities()
        my_cities = cities_obj.getCitiesFromDb()
        my_cities.insert(0, 'All Cities')
        parameters_for_template = {
            'cities': my_cities,
            'user': user,
            'owners': owners
        }
        template = jinja_environment.get_template('filter_owners.html')
        self.response.write(template.render(parameters_for_template))