Spaces:
Sleeping
Sleeping
JairoDanielMT
commited on
Commit
•
221c09e
1
Parent(s):
d3addb7
Update routers/productos.py
Browse files- routers/productos.py +5 -2
routers/productos.py
CHANGED
@@ -51,11 +51,14 @@ def search_productos(nombre: str):
|
|
51 |
try:
|
52 |
with DatabaseConnection().get_connection() as conn:
|
53 |
cursor = conn.cursor()
|
54 |
-
|
55 |
-
like_pattern = f"%{
|
56 |
cursor.execute(
|
57 |
"SELECT Nombre, Precio FROM productos WHERE Nombre LIKE ? ORDER BY Precio",
|
58 |
(like_pattern,)
|
59 |
)
|
60 |
productos = cursor.fetchall()
|
61 |
return productos
|
|
|
|
|
|
|
|
51 |
try:
|
52 |
with DatabaseConnection().get_connection() as conn:
|
53 |
cursor = conn.cursor()
|
54 |
+
nombre_decodificado = urllib.parse.unquote(nombre)
|
55 |
+
like_pattern = f"%{nombre_decodificado}%"
|
56 |
cursor.execute(
|
57 |
"SELECT Nombre, Precio FROM productos WHERE Nombre LIKE ? ORDER BY Precio",
|
58 |
(like_pattern,)
|
59 |
)
|
60 |
productos = cursor.fetchall()
|
61 |
return productos
|
62 |
+
except Exception as e:
|
63 |
+
print(e)
|
64 |
+
return []
|