Esempio n. 1
0
    def get_category_images(self, category, limit=20):
        """
        Get method

        Fetches image IDs from a selected category from the DB, and limits the number displayed to 20. 
        """

        error = None
        images = False
        # Validates and sends the request to the DB.
        try:
            database = Database()
            images = database.get_category_images(category, limit)

        except Exception as err:
            # Identifies if flask is the cause of the error, and raises error if true.
            flask_app.logger.info(err)
            error = err

        if error:
            # Raise error from failed Firebase request.
            raise Exception(error)
        else:
            # Return on success.
            return images
Esempio n. 2
0
    def get_category_images(self, category, limit=20):
        
        error = None
        images = False
        
        try:
            database = Database()
            images = database.get_category_images(category, limit)

        except Exception as err:
            flask_app.logger.info(err)
            error = err

        if error:
            raise Exception(error)
        else:
            return images
Esempio n. 3
0
    def get_category_images(self, category, limit=20):

        error = None
        images = False

        try:
            #gets images from database
            database = Database()
            images = database.get_category_images(category, limit)

        except Exception as err:
            flask_app.logger.info(err)
            error = err

        if error:
            # Raise error from failed Firebase request
            raise Exception(error)
        else:
            return images
    def get_category_images(self, category, limit=20):

        error = None
        images = False

        try:
            database = Database()
            images = database.get_category_images(category, limit)

        except Exception as err:
            flask_app.logger.info(err)
            error = err

        if error:
            # Pass DB error back to controller.
            raise Exception(error)
        else:
            # successfully returned Pyrebase.
            return images
Esempio n. 5
0
    def get_category_images(self, category, limit=20):
        """
        This chunk here seems to govern categories. When the user asks for images in a certain category,
        this is what finds those categorical images. 
        """
        error = None
        images = False

        try:
            database = Database()
            images = database.get_category_images(category, limit)

        except Exception as err:
            flask_app.logger.info(err)
            error = err

        if error:
            raise Exception(error)
        else:
            return images
Esempio n. 6
0
    def get_category_images(self, category, limit=20):

        # Inital Variable Values
        error = None
        images = False

        #Tries to get the images
        try:
            database = Database()
            images = database.get_category_images(category, limit)
        # Failed to get images raise a exception
        except Exception as err:
            flask_app.logger.info(err)
            error = err
        # Check if we have an error
        if error:
            # We have error, pass it back to the controller
            raise Exception(error)
        else:
            # We have no errors, return images
            return images