Commits

Radim Novotny committed e07ca7d

Fixed custom SOLR_ADDRESS settings; fixed compatibility with lfs 0.6+

Comments (0)

Files changed (1)

lfs_solr/utils.py

+from django.conf import settings
 # pysolr imports
 from pysolr import Solr
 
 
 try:
     SOLR_ADDRESS = settings.SOLR_ADDRESS
-except:
+except AttributeError:
     from lfs_solr.settings import SOLR_ADDRESS
 
 def index_product(product):
         else:
             manufacturer_name = ""
 
+        try:
+            # lfs 0.6+
+            price = product.get_price(request=None)
+        except TypeError:  # TypeError - unexpected argument
+            # lfs 0.5
+            price = product.get_price()
+
         temp.append({
             "id" : product.id,
             "name" : product.get_name(),
-            "price" : product.get_price(),
+            "price" : price,
             "categories" : categories,
             "keywords" : product.get_meta_keywords(),
             "manufacturer" : manufacturer_name,