| Line 2... |
Line 2... |
| 2 |
Created on 27-Apr-2010
|
2 |
Created on 27-Apr-2010
|
| 3 |
|
3 |
|
| 4 |
@author: ashish
|
4 |
@author: ashish
|
| 5 |
'''
|
5 |
'''
|
| 6 |
from shop2020.config.client.ConfigClient import ConfigClient
|
6 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 7 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, \
|
7 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_category, \
|
| 8 |
to_t_category, 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
|
9 |
to_t_product_notification_request_count, to_t_voucher_item_mapping
|
| 10 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, \
|
10 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 11 |
retire_item, change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
11 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 12 |
update_item, start_item_on, close_session, retire_item_on, \
|
12 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 13 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
13 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 14 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
14 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| 15 |
get_latest_arrivals_catalog_ids, get_latest_arrivals_count, is_active, \
|
15 |
get_latest_arrivals_catalog_ids, get_latest_arrivals_count, is_active, \
|
| 16 |
get_best_sellers_catalog_ids, get_best_sellers_count, put_category_object, \
|
16 |
get_best_sellers_catalog_ids, get_best_sellers_count, put_category_object, \
|
| 17 |
get_category_object, mark_item_as_content_complete, generate_new_entity_id, \
|
17 |
get_category_object, mark_item_as_content_complete, generate_new_entity_id, \
|
| 18 |
get_category, get_all_categories, add_category, get_item_status_description, \
|
18 |
get_category, get_all_categories, add_category, get_item_status_description, \
|
| 19 |
check_similar_item, change_risky_flag, get_items_for_mastersheet, get_risky_items, \
|
19 |
check_similar_item, change_risky_flag, get_items_for_mastersheet, \
|
| 20 |
get_similar_items_catalog_ids, add_product_notification, send_product_notifications, \
|
20 |
get_risky_items, get_similar_items_catalog_ids, add_product_notification, \
|
| 21 |
get_all_brands_by_category, is_alive, get_item_pricing_by_source, \
|
21 |
send_product_notifications, get_all_brands_by_category, is_alive, \
|
| 22 |
add_source_item_pricing, get_all_sources, get_item_for_source, \
|
22 |
get_item_pricing_by_source, add_source_item_pricing, get_all_sources, \
|
| 23 |
get_all_source_pricing, get_item_count_by_status, search_items, \
|
23 |
get_item_for_source, get_all_source_pricing, get_item_count_by_status, \
|
| 24 |
get_search_result_count, get_product_notifications, get_product_notification_request_count, \
|
24 |
search_items, get_search_result_count, get_product_notifications, \
|
| - |
|
25 |
get_product_notification_request_count, get_all_similar_items_catalog_ids, \
|
| 25 |
get_all_similar_items_catalog_ids, add_similar_item_catalog_id, \
|
26 |
add_similar_item_catalog_id, delete_similar_item_catalog_id, \
|
| 26 |
delete_similar_item_catalog_id, add_authorization_log_for_item, \
|
27 |
add_authorization_log_for_item, get_thrift_item_list, get_all_brands, \
|
| 27 |
get_thrift_item_list, get_all_brands, get_coming_soon, get_coming_soon_catalog_ids, \
|
28 |
get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count, initialize, \
|
| 28 |
get_coming_soon_count, initialize, get_clearance_sale_catalog_ids, \
|
29 |
get_clearance_sale_catalog_ids, add_update_voucher_for_item, \
|
| 29 |
add_update_voucher_for_item, delete_voucher_for_item, get_voucher_amount, \
|
30 |
delete_voucher_for_item, get_voucher_amount, get_all_vouchers_for_item, \
|
| 30 |
get_all_vouchers_for_item, is_valid_catalog_id, check_risky_item, \
|
31 |
is_valid_catalog_id, check_risky_item, get_vat_percentage_for_item, \
|
| 31 |
get_vat_percentage_for_item, get_vat_amount_for_item
|
32 |
get_vat_amount_for_item, add_tag,get_all_tags,get_all_entities_by_tag_name,delete_tag
|
| 32 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
33 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 33 |
from shop2020.utils.Utils import log_entry, to_py_date
|
34 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 34 |
import datetime
|
35 |
import datetime
|
| 35 |
|
36 |
|
| 36 |
class CatalogServiceHandler:
|
37 |
class CatalogServiceHandler:
|
| Line 62... |
Line 63... |
| 62 |
log_entry(self, "addItem called")
|
63 |
log_entry(self, "addItem called")
|
| 63 |
try:
|
64 |
try:
|
| 64 |
return add_item(item)
|
65 |
return add_item(item)
|
| 65 |
finally:
|
66 |
finally:
|
| 66 |
close_session()
|
67 |
close_session()
|
| - |
|
68 |
|
| 67 |
|
69 |
|
| - |
|
70 |
def addTag(self, displayName, catalogId):
|
| - |
|
71 |
result = False
|
| - |
|
72 |
try:
|
| - |
|
73 |
return add_tag(displayName, catalogId)
|
| - |
|
74 |
except:
|
| - |
|
75 |
result = True
|
| - |
|
76 |
finally:
|
| - |
|
77 |
close_session()
|
| - |
|
78 |
return result
|
| - |
|
79 |
|
| - |
|
80 |
def getAllTags(self):
|
| - |
|
81 |
result = []
|
| - |
|
82 |
try:
|
| - |
|
83 |
result = get_all_tags()
|
| - |
|
84 |
except:
|
| - |
|
85 |
result = True
|
| - |
|
86 |
finally:
|
| - |
|
87 |
close_session()
|
| - |
|
88 |
return result
|
| - |
|
89 |
|
| - |
|
90 |
def getAllEntitiesByTagName(self,displayName):
|
| - |
|
91 |
result = []
|
| - |
|
92 |
try:
|
| - |
|
93 |
result = get_all_entities_by_tag_name(displayName)
|
| - |
|
94 |
except:
|
| - |
|
95 |
result = True
|
| - |
|
96 |
finally:
|
| - |
|
97 |
close_session()
|
| - |
|
98 |
return result
|
| - |
|
99 |
|
| - |
|
100 |
def deleteTag(self,displayName):
|
| - |
|
101 |
result = False
|
| - |
|
102 |
try:
|
| - |
|
103 |
return delete_tag(displayName)
|
| - |
|
104 |
except:
|
| - |
|
105 |
result = True
|
| - |
|
106 |
finally:
|
| - |
|
107 |
close_session()
|
| - |
|
108 |
return result
|
| - |
|
109 |
|
| 68 |
def isActive(self, item_id):
|
110 |
def isActive(self, item_id):
|
| 69 |
"""
|
111 |
"""
|
| 70 |
Parameters:
|
112 |
Parameters:
|
| 71 |
- item_id
|
113 |
- item_id
|
| 72 |
"""
|
114 |
"""
|