class PGDatabaseConnector(implements(DatabaseInterface)):
    def fetchIngredientsFromSearch(self, term, limit):
        results = PGDatabase().getIngredientsFromSearchTerm(term, limit)
        return results

    def createRecipe(self, recipe):
        if not recipe.name:
            raise MissingRecipeField("Missing name")
        if not recipe.servingSize:
            raise MissingRecipeField("Missing serving size")
        if not recipe.cuisine:
            raise MissingRecipeField("Missing cuisine")
        if not recipe.mealType:
            raise MissingRecipeField("Missing meal type")
        if not recipe.ingredients:
            raise MissingRecipeField("Missing ingredients")

        PGDatabase().insertRecipe(recipe.name, recipe.servingSize,
                                  recipe.cuisine, recipe.mealType,
                                  recipe.ingredients)
class Cash(implements(Payment)):
    def execute(self):
        print("Cash On")
class Bkash(implements(Payment)):
    def execute(self):
        print("Bkash")
class Rocket(implements(Payment)):
    def execute(self):
        print("Rocket")
Exemple #5
0
class Circle(implements(Shape)):
    def draw() -> Shape:
        print('Circle is created')
Exemple #6
0
class AnotherShape(implements(Shape)):
    def draw() -> Shape:
        print('Another shape is created')
Exemple #7
0
class Triangle(implements(Shape)):
    def draw() -> Shape:
        print('Triangle is created')
Exemple #8
0
class Rectangle(implements(Shape)):
    def draw() -> Shape:
        print('Rectangle is created')