Esempio n. 1
0
    def get_image(self, image_id):
        """
        Get method.

        Processes request and fetches image ID, and displays the fetched image for the user.
        """
        error = None
        image = False

        # Validates the request and fetches the ID from the DB.
        try:
            database = Database()
            image = database.get_image(image_id)

        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 image
Esempio n. 2
0
    def get_image(self, image_id):
        
        error = None
        image = False
        
        try:
            database = Database()
            image = database.get_image(image_id)

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

        if error:
            raise Exception(error)
        else:
            return image
Esempio n. 3
0
 def get_image(self, image_id):
     # Inital Variable Values
     error = None
     image = False
     #Tries to pull image id
     try:
         database = Database()
         image = database.get_image(image_id)
     # 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 controller
         raise Exception(error)
     else:
         # We have no errors, return images
         return image
Esempio n. 4
0
    def get_image(self, image_id):
        """
        This segment here.. Seems like it searches for info on a very specific image.
        """
        error = None
        image = False

        try:
            database = Database()
            image = database.get_image(image_id)

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

        if error:
            raise Exception(error)
        else:
            return image
Esempio n. 5
0
    def get_image(self, image_id):

        error = None
        image = False

        try:
            #gets images from database
            database = Database()
            image = database.get_image(image_id)

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

        if error:
            # Raise error from failed Firebase request
            raise Exception(error)
        else:
            return image