@@ -1591,36 +1591,39 @@ def get_scientific_data_product_list(self, *, observation_id=None, tile_index=No
1591
1591
f"Invalid combination of parameters: category={ category } ; group={ group } . Valid "
1592
1592
f"values:\n { pprint .pformat (conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS )} " )
1593
1593
1594
+ product_type_for_category_list = conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS [category ][group ]
1595
+
1594
1596
if product_type is not None :
1595
1597
1596
- if product_type not in conf . VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS [ category ][ group ] :
1598
+ if product_type not in product_type_for_category_list :
1597
1599
raise ValueError (
1598
1600
f"Invalid combination of parameters: category={ category } ; group={ group } ; "
1599
1601
f"product_type={ product_type } . Valid values:\n "
1600
1602
f"{ pprint .pformat (conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS )} " )
1601
1603
1602
- query_extra_condition = query_extra_condition + (f" AND category={ category } AND group={ group } AND "
1603
- f"product_type={ product_type } " )
1604
+ query_extra_condition = query_extra_condition + f" AND product_type ='{ product_type } ' "
1604
1605
else :
1605
- query_extra_condition = query_extra_condition + f" AND category={ category } AND group={ group } "
1606
- else :
1607
- if product_type is not None :
1608
1606
1609
- product_type_list = [item for row in
1610
- conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS [category ].values ()
1611
- for item in row ]
1607
+ final_products = ', ' .join (f"'{ w } '" for w in product_type_for_category_list )
1608
+ query_extra_condition = query_extra_condition + f" AND product_type IN ({ final_products } ) "
1609
+ else : # category is not None and group is None
1610
+
1611
+ product_type_for_category_list = [item for row in
1612
+ conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS [category ].values ()
1613
+ for item in row ]
1614
+ if product_type is not None :
1612
1615
1613
- if product_type not in product_type_list :
1616
+ if product_type not in product_type_for_category_list :
1614
1617
raise ValueError (
1615
1618
f"Invalid combination of parameters: category={ category } ; product_type={ product_type } ."
1616
1619
f" Valid values:\n { pprint .pformat (conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS )} " )
1617
1620
1618
- query_extra_condition = query_extra_condition + (f" AND category={ category } AND product_type="
1619
- f"{ product_type } " )
1621
+ query_extra_condition = query_extra_condition + f" AND product_type = '{ product_type } ' "
1620
1622
1621
- else :
1622
- query_extra_condition = query_extra_condition + f" AND category={ category } "
1623
- else :
1623
+ else : # category is not None and group is None and product_type is None
1624
+ final_products = ', ' .join (f"'{ w } '" for w in product_type_for_category_list )
1625
+ query_extra_condition = query_extra_condition + f" AND product_type IN ({ final_products } ) "
1626
+ else : # category is None
1624
1627
1625
1628
category_group_dict = {}
1626
1629
for i in conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS .keys ():
@@ -1642,22 +1645,26 @@ def get_scientific_data_product_list(self, *, observation_id=None, tile_index=No
1642
1645
f"Invalid combination of parameters: group={ group } ; product_type={ product_type } . Valid "
1643
1646
f"values:\n { pprint .pformat (conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS )} " )
1644
1647
1645
- query_extra_condition = query_extra_condition + (f" AND group={ group } AND product_type="
1646
- f"{ product_type } " )
1647
- else :
1648
- query_extra_condition = query_extra_condition + f" AND group={ group } "
1648
+ query_extra_condition = query_extra_condition + f" AND product_type = '{ product_type } ' "
1649
+ else : # product_type is None
1649
1650
1650
- else :
1651
+ product_type_for_category_list = [element for sublist in category_group_dict .values () for element in
1652
+ sublist ]
1653
+ final_products = ', ' .join (f"'{ w } '" for w in product_type_for_category_list )
1654
+ query_extra_condition = query_extra_condition + f" AND product_type IN ({ final_products } ) "
1655
+
1656
+ else : # category is None and group is None
1651
1657
1652
- product_type_list = [element for row in category_group_dict .values () for element in row ]
1658
+ product_type_for_category_list = [element for sublist in category_group_dict .values () for element in
1659
+ sublist ]
1653
1660
1654
1661
if product_type is not None :
1655
- if product_type not in product_type_list :
1662
+ if product_type not in product_type_for_category_list :
1656
1663
raise ValueError (
1657
1664
f"Invalid combination of parameters: product_type={ product_type } . Valid values:\n "
1658
1665
f"{ pprint .pformat (conf .VALID_LE3_PRODUCT_TYPES_CATEGORIES_GROUPS )} " )
1659
1666
1660
- query_extra_condition = query_extra_condition + f" AND product_type= { product_type } "
1667
+ query_extra_condition = query_extra_condition + f" AND product_type = ' { product_type } ' "
1661
1668
1662
1669
else :
1663
1670
query_extra_condition = query_extra_condition + ""
0 commit comments