Commits

Kai Diefenbach committed b7aab55

CartItem.get_properties: add try/catch around getting property options

Comments (0)

Files changed (1)

lfs/cart/models.py

                 continue
 
             if property.is_select_field:
-                option = PropertyOption.objects.get(pk=int(float(cipv.value)))
-                value = option.name
-                price = option.price
+                try:
+                    option = PropertyOption.objects.get(pk=int(float(cipv.value)))
+                except (PropertyOption.DoesNotExist, ValueError):
+                    value = cipv.value
+                    price = 0.0
+                else:
+                    value = option.name
+                    price = option.price
+                
             else:                
                 format_string = "%%.%sf" % property.decimal_places
                 try: