Subversion Repositories SmartDukaan

Rev

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

Rev 9724 Rev 9776
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, to_t_marketplace_items
13
    to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, to_t_marketplace_itemprice
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 53... Line 53...
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, get_snapdeal_item_detail,\
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
    get_marketplace_details_for_item, update_marketplace_attributes_for_item, \
-
 
59
    get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status
59
from shop2020.thriftpy.model.v1.catalog.ttypes import status
60
from shop2020.thriftpy.model.v1.catalog.ttypes import status
60
from shop2020.utils.Utils import log_entry, to_py_date
61
from shop2020.utils.Utils import log_entry, to_py_date
61
import datetime
62
import datetime
62
 
63
 
63
class CatalogServiceHandler:
64
class CatalogServiceHandler:
Line 1382... Line 1383...
1382
            for feedSubmit in feedSubmits:
1383
            for feedSubmit in feedSubmits:
1383
                if feedSubmit:
1384
                if feedSubmit:
1384
                    ret_feedSubmits.append(to_t_product_feed_submit(feedSubmit))
1385
                    ret_feedSubmits.append(to_t_product_feed_submit(feedSubmit))
1385
            return ret_feedSubmits
1386
            return ret_feedSubmits
1386
        finally:
1387
        finally:
1387
            close_session()   
1388
            close_session()
-
 
1389
     
-
 
1390
    def getMarketPlaceItemsForPriceUpdate(self,source):
-
 
1391
        try:
-
 
1392
            items = get_all_marketplace_items_for_priceupdate(source) 
-
 
1393
            return [to_t_marketplace_itemprice(item) for item in items]
-
 
1394
        finally:
-
 
1395
            close_session()
-
 
1396
            
-
 
1397
    def updateMarketPlacePriceUpdateStatus(self,skulist,timestamp):
-
 
1398
        try:
-
 
1399
            update_marketplace_priceupdate_status(skulist,timestamp)
-
 
1400
        finally:
-
 
1401
            close_session()
-
 
1402
            
-
 
1403
    
-
 
1404
if __name__ == '__main__':
-
 
1405
    items = get_all_alive_items()
-
 
1406
    ret_items = []
-
 
1407
    for item in items:
-
 
1408
        if item:
-
 
1409
            ret_items.append(to_t_item(item))
-
 
1410
    print ret_items
-
 
1411
          
1388
            
1412
            
1389
def is_valid(item):
1413
def is_valid(item):
1390
    if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
1414
    if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
1391
        if item.startDate:
1415
        if item.startDate:
1392
            return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
1416
            return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
Line 1395... Line 1419...
1395
    elif item.status == status.COMING_SOON:
1419
    elif item.status == status.COMING_SOON:
1396
        return True
1420
        return True
1397
    else:
1421
    else:
1398
        return False
1422
        return False
1399
 
1423
 
1400
    
-
 
1401
if __name__ == '__main__':
-
 
1402
    items = get_all_alive_items()
-
 
1403
    ret_items = []
-
 
1404
    for item in items:
-
 
1405
        if item:
-
 
1406
            ret_items.append(to_t_item(item))
-
 
1407
    print ret_items
-