| Line 42... |
Line 42... |
| 42 |
items = get_mongo_connection().Catalog.MasterData.find({'source_id' : { "$in": SOURCE_MAP.values() } })
|
42 |
items = get_mongo_connection().Catalog.MasterData.find({'source_id' : { "$in": SOURCE_MAP.values() } })
|
| 43 |
print items.count()
|
43 |
print items.count()
|
| 44 |
for item in items:
|
44 |
for item in items:
|
| 45 |
title = xstr(item['brand'])+" "+xstr(item['model_name'])
|
45 |
title = xstr(item['brand'])+" "+xstr(item['model_name'])
|
| 46 |
if not catalogMap.has_key(str(item['skuBundleId'])+" "+title):
|
46 |
if not catalogMap.has_key(str(item['skuBundleId'])+" "+title):
|
| 47 |
catalogMap[str(item['skuBundleId'])+" "+title] = [title ,item['thumbnail']]
|
47 |
catalogMap[str(item['skuBundleId'])+" "+title] = [title]
|
| 48 |
s_info = __SkuInfo(str(item['_id']),int(item['skuBundleId']),(item['brand']),(item['model_name']),(item['source_product_name']),int(item['category_id']),categoryMap.get(item['category_id']),float(item['available_price']),float(item['mrp']),item['in_stock'], \
|
48 |
s_info = __SkuInfo(str(item['_id']),int(item['skuBundleId']),(item['brand']),(item['model_name']),(item['source_product_name']),int(item['category_id']),categoryMap.get(item['category_id']),float(item['available_price']),float(item['mrp']),item['in_stock'], \
|
| 49 |
int(item['source_id']),(item['source']),title,(item['thumbnail']), long(item['priceUpdatedOn']))
|
49 |
int(item['source_id']),(item['source']),title,(item['thumbnail']), long(item['priceUpdatedOn']))
|
| 50 |
l.append(s_info.__dict__)
|
50 |
l.append(s_info.__dict__)
|
| 51 |
solr.add(l)
|
51 |
solr.add(l)
|
| 52 |
|
52 |
|
| 53 |
|
53 |
autoSuggestList = []
|
| - |
|
54 |
for v in catalogMap.itervalues():
|
| - |
|
55 |
autoSuggestList.append({'val':v})
|
| 54 |
PATH = os.path.expanduser(filePath)
|
56 |
PATH = os.path.expanduser(filePath)
|
| 55 |
if os.path.isfile(PATH):
|
57 |
if os.path.isfile(PATH):
|
| 56 |
try:
|
58 |
try:
|
| 57 |
os.remove(os.path.expanduser(filePath))
|
59 |
os.remove(os.path.expanduser(filePath))
|
| 58 |
except OSError:
|
60 |
except OSError:
|
| 59 |
pass
|
61 |
pass
|
| 60 |
output = open(filePath, 'ab+')
|
62 |
output = open(filePath, 'ab+')
|
| 61 |
json.dump(catalogMap, output)
|
63 |
json.dump(autoSuggestList, output)
|
| 62 |
output.close()
|
64 |
output.close()
|
| 63 |
shutil.copy2(filePath, destFilePath)
|
65 |
shutil.copy2(filePath, destFilePath)
|
| 64 |
|
66 |
|
| 65 |
|
67 |
|
| 66 |
|
68 |
|