Fixed all pep8 warnings
This commit is contained in:
@@ -22,7 +22,11 @@ class ProductController(DatabaseController):
|
||||
]
|
||||
|
||||
self._conn.execute(
|
||||
"INSERT INTO Products (name, image, description, cost, categoryID, sellerID, postedDate, quantityAvailable) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"""
|
||||
INSERT INTO Products
|
||||
(name, image, description, cost, categoryID,
|
||||
sellerID, postedDate, quantityAvailable)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
|
||||
params
|
||||
)
|
||||
self._conn.commit()
|
||||
@@ -38,7 +42,7 @@ class ProductController(DatabaseController):
|
||||
)
|
||||
rows = cursor.fetchmany()
|
||||
|
||||
if rows == None:
|
||||
if rows is None:
|
||||
return None
|
||||
|
||||
products = list()
|
||||
@@ -51,16 +55,17 @@ class ProductController(DatabaseController):
|
||||
|
||||
return products
|
||||
|
||||
def read_all(self, category: str = "", search_term: str = "") -> list[Product] | None:
|
||||
def read_all(self, category: str = "",
|
||||
search_term: str = "") -> list[Product] | None:
|
||||
params = [
|
||||
"%" + category + "%",
|
||||
"%" + search_term + "%"
|
||||
]
|
||||
|
||||
cursor = self._conn.execute(
|
||||
"""SELECT * FROM Products
|
||||
INNER JOIN Categories ON Products.categoryID = Categories.id
|
||||
WHERE Categories.name LIKE ?
|
||||
"""SELECT * FROM Products
|
||||
INNER JOIN Categories ON Products.categoryID = Categories.id
|
||||
WHERE Categories.name LIKE ?
|
||||
AND Products.name LIKE ?
|
||||
""",
|
||||
params
|
||||
|
||||
Reference in New Issue
Block a user