예제 #1
0
def deleteProduct(productName):
    for product in products:
        if (product["name"] == productName):
            products.remove(product)
            return jsonify({"message": "Product was delete successfully"})

    return jsonify({"message": 'This product is not registered'})
예제 #2
0
def deleteProduct(product_name):
    productFound = [product for product in products if product['name'] == product_name]
    if (len(productFound) > 0):
        products.remove(productFound[0])
        return jsonify({"message": "Product deleted", "products": products})
    else:
        return jsonify({"message": "Product not found"})
예제 #3
0
def deleteProduct(product_name):
    productsFound = [
        product for product in products if product['name'] == product_name
    ]
    if len(productsFound) > 0:
        products.remove(productsFound[0])
        return jsonify({'message': 'Product Deleted', 'products': products})
예제 #4
0
def deliteProduct(product_name):
    productsFound = [
        product for product in products if product['nombre'] == product_name
    ]
    if (len(productsFound) > 0):
        products.remove(productsFound[0])
        return jsonify({"mensage": "producto eliminado", "products": products})
    return jsonify({"mensage": "producto no encontrado"})
예제 #5
0
def deleteProduct(product_name):
    productFound = [
        product for product in products if product["name"] == product_name
    ]
    if productFound:
        products.remove(productFound[0])
        return jsonify({"message": "producto Deleted", "products": products})
    return jsonify({"message": "Product not found"})
예제 #6
0
def deleteProduct(product_name):
    productsFound = [
        product for product in products if product['name'] == product_name
    ]
    if len(productsFound) > 0:
        products.remove(productsFound[0])
        return jsonify({"message": "Product Deleted", "products": products})
    return jsonify({"message": "Product Not found"})
예제 #7
0
def deleteProduct(product_name):
    for product in products:
        if product['name'] == product_name.lower():
            productsFound = product
    #productsFound = [product for product in products if product['name'] == product_name]
    if len(productsFound) > 0:
        products.remove(productsFound[0])
        return jsonify({'message': 'Producto Borrado', 'products': products})
예제 #8
0
def delete_product(product_name):
    product_found = [
        product for product in products if product["name"] == product_name
    ]
    if (len(product_found) > 0):
        products.remove(product_found[0])
        return jsonify({"Message": "Product deleted", "Products": products})
    return jsonify({"Message": "Product not found"})
예제 #9
0
def deleteProduct(product_name):
    productsFound = [
        product for product in products if product['name'] == product_name.capitalize()]
    if len(productsFound) > 0:
        products.remove(productsFound[0])
        return jsonify({"message": "deleted", "products": products})
    else:
        return jsonify({"message": "product not found"})
예제 #10
0
def deleteProduct(product_name):
    productFound = [
        product for product in products if product['name'] == product_name
    ]
    if (len(productFound) > 0):
        products.remove(productFound[0])
        return jsonify({'message': 'Product deleted', 'products': products})
    return jsonify({"message": "product unavailable"})
예제 #11
0
def deleteProduct(product_name):
    productsFound = [product for product in products if product['name'] == product_name]
    if len(productsFound) > 0:
        products.remove(productsFound[0])
        return jsonify({
           "message": "Producto borrado",
           "products": products 
        })
    return jsonify({"message: Producto no encontrado"})
예제 #12
0
def deleteProduct(produc_name):
    producto = [
        product for product in products if product['name'] == produc_name
    ]
    if (len(producto) > 0):
        products.remove(producto[0])
        return jsonify({"mensaje": "eliminado", "productos": products})
    else:
        return jsonify({"mensaje": "prodcuto no encontrado"})
예제 #13
0
def deleteProduct(product_name):
    productFounts = [
        product for product in products if product['name'] == product_name
    ]
    if (len(productFounts) > 0):
        products.remove(productFounts[0])
        return jsonify({"message": "Producto eliminado satifactoriamente"})
    else:
        return jsonify({"message": "Producto no encontrado"})
예제 #14
0
def delete_product(product_name):
    products_found = [
        product for product in products if product["name"] == product_name
    ]
    if len(products_found) > 0:
        products.remove(products_found[0])
        return jsonify({"message": "product deleted", "products": products})
    else:
        return jsonify({"error": "product not found"})
예제 #15
0
def deleteProduct(product_name):
    ProductFoundDelete = [product for product in products if product['name'] == product_name]
    if (len(ProductFoundDelete) >0 ):
        products.remove(ProductFoundDelete[0])
        return jsonify({
            "message" : "Product Delete", 
            "products": products
            })

    return jsonify({"message" : "Product Not Found, not delete"})
예제 #16
0
def deleteProduct(product_name):
    ProductFound = [product for product in products if product['name'] == product_name]
    if len(ProductFound)  > 0:
        #from list products, using "remove property" inside parenthesis fist product found in the list ProductFound
        products.remove(ProductFound[0])

        return jsonify({
            "Message": "Product " + product_name + " Was Deleted Successfully",
            "Product List": products
        })        
    return jsonify({"Message " : "Product Not Found"})
예제 #17
0
def deleteProduct(product_name):
    productFound = [
        product for product in products if product['name'] == product_name
    ]
    if len(productFound):
        products.remove(productFound[0])
        return jsonify({
            "message": "Product removed from products",
            "products": products
        })
    return jsonify("Product not Found")
예제 #18
0
def deleteProduct(product_brand):
    # obtenemos solo el producto solicitado
    product_found = [
        product for product in products if product['brand'] == product_brand
    ]
    # Si el tamaño de la lista es mayor a 0 entonces existen productos
    if (len(product_found) > 0):
        # Eliminamos el producto encontrado
        products.remove(product_found[0])
        # Retornamos el producto o productos encontrados
        return redirect('http://127.0.0.1/exampleRest/')
    return jsonify([{"product": "Producto no encontrado"}])
예제 #19
0
def deleteProduct(product_name):
    product_found = [
        product for product in products if product['name'] == product_name
    ]
    if (len(product_found)) > 0:
        products.remove(product_found[0])
        return jsonify({
            "message": "Produc Deleted",
            "products": products,
            "status": 200
        })
    return jsonify({"message": "product not found", "status": 400})
예제 #20
0
def deleteProduct(product_name):
    #Igual que antes se verifica si existe
    productFound = [product for product in products if product['name'] == product_name]
    if (len(productFound) > 0):
        #Se elimina
        products.remove(productFound[0])
        #Se imprime
        return jsonify({
            "message": "Product deleted",
            "product": products
        })
    #No existe algo que editar
    return jsonify({"message": "Product not found"})
예제 #21
0
def deleteProduct(product_name):
    for product in products:
        if product.get("name") == product_name:
            products.remove(product)
            return jsonify({
                "message": "Product Deleted",
                "delete_product": products,
            })
    else:
        return jsonify({
            "error": "Product not Found",
            "message": "❌ Product not found"
        })
예제 #22
0
def deleteProduct(id_product):
    productsFound = [
        product for product in products if product['id'] == id_product
    ]
    if (len(productsFound) > 0):
        print(products)
        print(productsFound)
        products.remove(productsFound[0])
        return jsonify({
            "Message": "Product deleted successfully",
            "Products": products
        })
    return jsonify({"Message": "Product not found"})
예제 #23
0
def productDelete(product_name):
    productFound = [ products for products in products if products['name'] == product_name]

    if ( len(productFound) > 0 ):
        products.remove(productFound[0])

        return jsonify({
            "message":"product delete list"
        })



    return jsonify({
        "message": "product no found in delete"
    })
예제 #24
0
def deleteProduct( productName ):
	
	if len( products ) > 0:

		for product in products:
			
			if product['name'] == productName:
				products.remove( product )

				return jsonify({
					'message': 'producto actualizado',
					'products': products
				})

		# sino encuentra producto
		return jsonify({ 'message': 'producto no encontrado' })

	# sino encuentra productos registrados
	return jsonify({ 'message': 'no hay productos registrados' })
예제 #25
0
def deleteproduct(product_name):
    productFound = [product for product in products if product['name'] == product_name]
    if (len(productFound) > 0):
        products.remove(productFound[0])
        return jsonify({"New list of Products":products})
    return jsonify({"message":"Product not Found"})
예제 #26
0
def productDelete(id):
  foundList = [product for product in products if product['id'] == id]
  if (len(foundList) > 0):
    products.remove(foundList[0])
    return jsonify({"message": "product deleted", "products": products})
  return jsonify({ "message": "product not found"})
예제 #27
0
def deleteProduct(argv):
    productFound = [product for product in products if product['name'] == argv]
    if (len(productFound) > 0):
        products.remove(productFound[0])
        return jsonify({'message': 'Product deleted', 'products': products})
    return jsonify({'message': 'Product not found'})
예제 #28
0
def deleteProduct(product_name):
    productsFound = [product for product in products if product['name'] == product_name]
    if len(productsFound) > 0:
        products.remove(productsFound[0])
        jsonify({'response' : 'OK'})
    return jsonify({'message': 'ERROR'})