diff --git a/utils/auctionutils.py b/utils/auctionutils.py index 5f4a780..831e2e5 100644 --- a/utils/auctionutils.py +++ b/utils/auctionutils.py @@ -162,14 +162,18 @@ def getOVMAuctions(): image = ""; image = result.get('image', "") if image == "": - image = result.get('imageList', [""])[0] + images = result.get('imageList') + if(len(images) >0): + image = images[0]; + else: + log("No image found for OVM auction: " + result['naam']) a = Auction(Auctionbrand.OVM, cityname,result['land'], result['naam'],startdatetime, enddatetime, str(result['land']).lower() + '/veilingen/' + str(result['id']) + '/kavels', 'images/150x150/' + image, result['totaalKavels'] ) auctions.append(a) Cache.add(cachename, auctions) return auctions except Exception as e: - log('Something went wrong in the mapping of OVM auctions to auctionviewer objects. The reason was: ' + response.reason + '. The response was: ' + JsonEncoder().encode(response.json())) + log(e.__cause__ + '-- Something went wrong in the mapping of OVM auctions to auctionviewer objects. The reason was: ' + response.reason + '. The response was: ' + JsonEncoder().encode(response.json())) print_exc(e) else: diff --git a/utils/helperutils.py b/utils/helperutils.py index e3c267f..c1413ed 100644 --- a/utils/helperutils.py +++ b/utils/helperutils.py @@ -2,9 +2,3 @@ from datetime import datetime, timedelta def log(value): print(str(datetime.now()) + ' ' + value) - # try: - # print(str(datetime.now()) + ' ' + value.encode("utf-8")) - # except: - # print(str(datetime.now()) + ' print error') - - #print(u' '.join(( str(datetime.now()), value)).encode('utf-8').strip()) \ No newline at end of file