Skip to content

Commit 2c8bac3

Browse files
authored
Update ordering.py
updated the code as suggested.
1 parent d37e6fe commit 2c8bac3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

SoftLayer/managers/ordering.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def __init__(self, client):
3434
self.order_svc = client['Product_Order']
3535
self.billing_svc = client['Billing_Order']
3636
self.package_preset = client['Product_Package_Preset']
37+
self.package_mask = 'id, description, capacity, itemCategory, keyName, prices[categories], ' \
38+
'softwareDescription[id,referenceCode,longDescription]'
3739

3840
def get_packages_of_type(self, package_types, mask=None):
3941
"""Get packages that match a certain type.
@@ -384,15 +386,14 @@ def get_price_id_list(self, package_keyname, item_keynames, core=None):
384386
matching_item = []
385387
# Need to find the item in the package that has a matching
386388
# keyName with the current item we are searching for
387-
try:
388389
for i in items:
389390
referenceCode = utils.lookup(i, 'softwareDescription', 'referenceCode')
390391
if i['keyName'] == item_keyname or referenceCode == item_keyname:
391392
matching_item.append(i)
392-
except IndexError as ex:
393+
393394
if len(matching_item) == 0:
394395
message = f"Item {item_keyname} does not exist for package {package_keyname}"
395-
raise exceptions.SoftLayerError(message) from ex
396+
raise exceptions.SoftLayerError(message)
396397
matching_item = matching_item[0]
397398

398399
# we want to get the price ID that has no location attached to it,

0 commit comments

Comments
 (0)