Subversion Repositories SmartDukaan

Rev

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

Rev 8619 Rev 8739
Line 7... Line 7...
7
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_category, \
7
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_category, \
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
12
    to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item
13
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
13
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
14
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
14
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
15
    update_item, start_item_on, close_session, retire_item_on, \
15
    update_item, start_item_on, close_session, retire_item_on, \
16
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
16
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
17
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
17
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
Line 46... Line 46...
46
    get_all_parent_categories,add_page_view_event,add_cart_event, \
46
    get_all_parent_categories,add_page_view_event,add_cart_event, \
47
    insert_ebay_item, get_ebay_item, update_ebay_item, update_amazon_attributes_in_bulk, \
47
    insert_ebay_item, get_ebay_item, update_ebay_item, update_amazon_attributes_in_bulk, \
48
    get_all_items_to_list_on_fba,get_all_items_to_list_on_nonfba, \
48
    get_all_items_to_list_on_fba,get_all_items_to_list_on_nonfba, \
49
    update_banner,add_banner_uri,get_uri_mapping,add_campaign,get_campaigns, \
49
    update_banner,add_banner_uri,get_uri_mapping,add_campaign,get_campaigns, \
50
    delete_campaign, get_all_campaigns, get_amazon_listed_items, search_amazon_items, \
50
    delete_campaign, get_all_campaigns, get_amazon_listed_items, search_amazon_items, \
51
    get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin
51
    get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin, \
-
 
52
    add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items
52
 
53
 
53
from shop2020.thriftpy.model.v1.catalog.ttypes import status
54
from shop2020.thriftpy.model.v1.catalog.ttypes import status
54
from shop2020.utils.Utils import log_entry, to_py_date
55
from shop2020.utils.Utils import log_entry, to_py_date
55
import datetime
56
import datetime
56
 
57
 
Line 1266... Line 1267...
1266
                    ret_items.append(to_t_item(item))
1267
                    ret_items.append(to_t_item(item))
1267
            return ret_items
1268
            return ret_items
1268
        finally:
1269
        finally:
1269
            close_session()
1270
            close_session()
1270
            
1271
            
-
 
1272
    def addOrUpdateSnapdealItem(self,snapdealitem):
-
 
1273
        try:
-
 
1274
            return add_or_update_snapdeal_item(snapdealitem)
-
 
1275
        finally:    
-
 
1276
            close_session()
-
 
1277
            
-
 
1278
    def getSnapdealItem(self,item_id):
-
 
1279
        try:
-
 
1280
            return to_t_snapdeal_item(get_snapdeal_item(item_id))
-
 
1281
        finally:
-
 
1282
            close_session()
-
 
1283
            
-
 
1284
    def getAllSnapdealItems(self):
-
 
1285
        try:
-
 
1286
            items = get_all_snapdeal_items() 
-
 
1287
            return [to_t_snapdeal_item(item) for item in items]
-
 
1288
        finally:
-
 
1289
            close_session() 
-
 
1290
            
1271
def is_valid(item):
1291
def is_valid(item):
1272
    if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
1292
    if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
1273
        if item.startDate:
1293
        if item.startDate:
1274
            return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
1294
            return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
1275
        else:
1295
        else: