Skip to content

Commit

Permalink
Altered shipping scales to use attribute code, not name
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinthehole committed May 31, 2012
1 parent 0537ba6 commit adfc96c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions oscar/apps/shipping/__init__.py
Expand Up @@ -5,13 +5,13 @@ class Scales(object):
"""
For calculating the weight of a product or basket
"""
def __init__(self, attribute='weight', default_weight=None):
self.attribute = attribute
def __init__(self, attribute_code='weight', default_weight=None):
self.attribute = attribute_code
self.default_weight = default_weight

def weigh_product(self, product):
try:
attr_val = product.attribute_values.get(attribute__name=self.attribute)
attr_val = product.attribute_values.get(attribute__code=self.attribute)
except ObjectDoesNotExist:
if self.default_weight is None:
raise ValueError("No attribute %s found for product %s" % (self.attribute, product))
Expand Down

0 comments on commit adfc96c

Please sign in to comment.