Subversion Repositories SmartDukaan

Rev

Rev 9621 | Rev 9776 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9621 Rev 9724
Line 8... Line 8...
8
    to_t_source_item_pricing, to_t_product_notification_request, \
8
    to_t_source_item_pricing, to_t_product_notification_request, \
9
    to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer, \
9
    to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer, \
10
    to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
10
    to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
11
    to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
11
    to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
12
    to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
12
    to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
13
    to_t_snapdeal_item_details, to_t_product_feed_submit    
13
    to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items
14
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
14
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
15
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
15
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
16
    update_item, start_item_on, close_session, retire_item_on, \
16
    update_item, start_item_on, close_session, retire_item_on, \
17
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
17
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
18
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
18
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
Line 52... Line 52...
52
    get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin, \
52
    get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin, \
53
    add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items , get_snapdeal_items, \
53
    add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items , get_snapdeal_items, \
54
    search_snapdeal_items , get_count_for_snapdeal_items , get_snapdeal_search_result_count, \
54
    search_snapdeal_items , get_count_for_snapdeal_items , get_snapdeal_search_result_count, \
55
    get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
55
    get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
56
    get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
56
    get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
57
    delete_product_feed_submit, get_all_product_feed_submit
57
    delete_product_feed_submit, get_all_product_feed_submit, get_snapdeal_item_detail,\
-
 
58
    get_marketplace_details_for_item, update_marketplace_attributes_for_item
58
from shop2020.thriftpy.model.v1.catalog.ttypes import status
59
from shop2020.thriftpy.model.v1.catalog.ttypes import status
59
from shop2020.utils.Utils import log_entry, to_py_date
60
from shop2020.utils.Utils import log_entry, to_py_date
60
import datetime
61
import datetime
61
 
62
 
62
class CatalogServiceHandler:
63
class CatalogServiceHandler:
Line 1287... Line 1288...
1287
        finally:
1288
        finally:
1288
            close_session()
1289
            close_session()
1289
    
1290
    
1290
    def getSnapdealItemDetails(self,item_id):
1291
    def getSnapdealItemDetails(self,item_id):
1291
        try:
1292
        try:
-
 
1293
            snapdealItem, snapdealInventory = get_snapdeal_item_detail(item_id)
1292
            return to_t_snapdeal_item_details(get_snapdeal_item(item_id))
1294
            return to_t_snapdeal_item_details(snapdealItem, snapdealInventory)
1293
        finally:
1295
        finally:
1294
            close_session()
1296
            close_session()
1295
            
1297
            
1296
    def getAllSnapdealItems(self):
1298
    def getAllSnapdealItems(self):
1297
        try:
1299
        try:
1298
            items = get_all_snapdeal_items() 
1300
            items = get_all_snapdeal_items() 
1299
            return [to_t_snapdeal_item_details(item) for item in items]
1301
            return [to_t_snapdeal_item_details(item,None) for item in items]
1300
        finally:
1302
        finally:
1301
            close_session()
1303
            close_session()
1302
            
1304
            
1303
    def getSnapdealItems(self,offset,limit):
1305
    def getSnapdealItems(self,offset,limit):
1304
        try:
1306
        try:
1305
            items = get_snapdeal_items(offset,limit) 
1307
            items = get_snapdeal_items(offset,limit) 
1306
            return [to_t_snapdeal_item_details(item) for item in items]
1308
            return [to_t_snapdeal_item_details(item,None) for item in items]
1307
        finally:
1309
        finally:
1308
            close_session()
1310
            close_session()
1309
            
1311
            
1310
    def searchSnapdealItems(self,searchterm,offset,limit):
1312
    def searchSnapdealItems(self,searchterm,offset,limit):
1311
        try:
1313
        try:
1312
            snapdealitems = []
1314
            snapdealitems = []
1313
            search_result = search_snapdeal_items(searchterm,offset,limit)
1315
            search_result = search_snapdeal_items(searchterm,offset,limit)
1314
            for snapdealitem in search_result:
1316
            for snapdealitem in search_result:
1315
                snapdealitems.append(to_t_snapdeal_item_details(snapdealitem))
1317
                snapdealitems.append(to_t_snapdeal_item_details(snapdealitem,None))
1316
        finally:
1318
        finally:
1317
            close_session()
1319
            close_session()
1318
            return snapdealitems
1320
            return snapdealitems
1319
    
1321
    
1320
    def getCountForSnapdealItems(self):
1322
    def getCountForSnapdealItems(self):
Line 1332... Line 1334...
1332
            
1334
            
1333
    def getSnapdealItembySkuAtSnapdeal(self,skuatsnapdeal):
1335
    def getSnapdealItembySkuAtSnapdeal(self,skuatsnapdeal):
1334
        try:
1336
        try:
1335
            return to_t_snapdeal_item(get_snapdealitem_by_skuatsnapdeal(skuatsnapdeal))
1337
            return to_t_snapdeal_item(get_snapdealitem_by_skuatsnapdeal(skuatsnapdeal))
1336
        finally:
1338
        finally:
-
 
1339
            close_session()
-
 
1340
    
-
 
1341
    def getMarketplacedetailsForItem(self,itemId,sourceId):
-
 
1342
        try:
-
 
1343
            return to_t_marketplace_items(get_marketplace_details_for_item(itemId,sourceId))
-
 
1344
        finally:
-
 
1345
            close_session()
-
 
1346
    
-
 
1347
    def updateMarketplaceAttributesForItem(self,marketplaceItem):
-
 
1348
        try:
-
 
1349
            return update_marketplace_attributes_for_item(marketplaceItem)
-
 
1350
        finally:
1337
            close_session()        
1351
            close_session() 
1338
            
1352
            
1339
    def getProductFeedSubmit(self, catalog_itemId):
1353
    def getProductFeedSubmit(self, catalog_itemId):
1340
        try:
1354
        try:
1341
            return to_t_product_feed_submit(get_product_feed_submit(catalog_itemId))
1355
            return to_t_product_feed_submit(get_product_feed_submit(catalog_itemId))
1342
        finally:
1356
        finally: