Use duck typing to convert single UPS package into a list
It seems that UPS has fixed its API such that it always returns a list for PackageResults but it is still better to test the actual result. Closes #13116 (grafted from 5aeb838f993f9d5e55c10a4b24f9ad6cd67eae55) --HG-- branch : 7.0
This commit is contained in:
1 parent
01ad452523
commit
c537c25fe1
1 file changed
+2
-2
@@ -213,8 +213,8 @@ class CreateShippingUPS(Wizard):
|
||||
shipment.shipping_reference = (
|
||||
shipment_results['ShipmentIdentificationNumber'])
|
||||
ups_packages = shipment_results['PackageResults']
|
||||
if len(packages) == 1:
|
||||
# In case only one package is requested UPS returns a dictionnary
|
||||
if not isinstance(ups_packages, list):
|
||||
# In case only one package is requested UPS may return a dictionary
|
||||
# instead of a list of one package
|
||||
ups_packages = [ups_packages]
|
||||
|
||||
|
||||
Reference in new issue
Block a user