diff --git a/modules/lacentrale/backend.py b/modules/lacentrale/backend.py index d45e7840..9c80fb69 100644 --- a/modules/lacentrale/backend.py +++ b/modules/lacentrale/backend.py @@ -78,24 +78,8 @@ class LaCentraleBackend(BaseBackend, ICapPriceComparison): # id is a url code part for one car page with self.browser: return self.browser.get_price(id) - ## inherited from ICapPriceComparison - #with self.browser: - #if isinstance(id, Price): - #print "get_price by price", id - #price = id - #else: - ##p_id, s_id = id.split('.', 2) - ##product = Product(p_id) - ##for price in self.iter_prices(product): - ##if price.id == id: - ##break - ##else: - #return None - ##price.shop.info = self.browser.get_shop_info(price.id.split('.', 2)[-1]) - #return price - #def fill_price(self, price, fields): - #print "VO lacentrale fill_price", price - #return self.get_price(price) + def fill_price(self, price, fields): + return self.get_price(price.id) - #OBJECTS = {Price: fill_price, } + OBJECTS = {Price: fill_price, } diff --git a/modules/lacentrale/pages.py b/modules/lacentrale/pages.py index 3a4956fa..4533726e 100644 --- a/modules/lacentrale/pages.py +++ b/modules/lacentrale/pages.py @@ -18,14 +18,12 @@ # along with weboob. If not, see . -#from decimal import Decimal -#import re +from decimal import Decimal +import re from weboob.tools.browser import BasePage, BrokenPageError from weboob.capabilities import NotAvailable, NotLoaded from weboob.capabilities.pricecomparison import Product, Price, Shop -import re -from decimal import Decimal __all__ = ['MainPage','ListingAutoPage'] @@ -42,6 +40,11 @@ class MainPage(BasePage): def get_decimal(s): return re.findall(r'\d+', s.replace(' ',''))[0] +def new_shop(id): + shop = Shop(id) + shop.set_empty_fields(NotLoaded) + return shop + def new_price(id, product, cost, title): price = Price(id) price.product = product @@ -49,10 +52,7 @@ def new_price(id, product, cost, title): price.currency = u'€' price.message = unicode(title) price.set_empty_fields(NotAvailable) - - price.shop = Shop(price.id) - price.shop.set_empty_fields(NotAvailable) # NotLoaded - + price.shop = new_shop(id) return price # I manage listing page and extract information