| Line 1... |
Line 1... |
| 1 |
'''
|
1 |
'''
|
| 2 |
Created on 28-Apr-2010
|
2 |
Created on 28-Apr-2010
|
| 3 |
|
3 |
|
| 4 |
@author: ashish
|
4 |
@author: ashish
|
| 5 |
'''
|
5 |
'''
|
| 6 |
from shop2020.utils.Utils import log_entry
|
6 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 7 |
from shop2020.model.v1.user.impl.UserDataAccessors import create_user, update_user, get_user_by_id, get_user_by_email, update_password,\
|
7 |
from shop2020.model.v1.user.impl.UserDataAccessors import create_user, update_user, get_user_by_id, get_user_by_email, update_password,\
|
| 8 |
set_user_as_logged_out, set_user_as_logged_in, remove_address_for_user,\
|
8 |
set_user_as_logged_out, set_user_as_logged_in, remove_address_for_user,\
|
| 9 |
add_address_for_user, authenticate_user, user_exists, initialize, set_default_address,\
|
9 |
add_address_for_user, authenticate_user, user_exists, initialize, set_default_address,\
|
| 10 |
create_anonymous_user, forgot_password, get_all_addresses_for_user, get_address, get_default_address_id, get_default_pincode,\
|
10 |
create_anonymous_user, forgot_password, get_all_addresses_for_user, get_address, get_default_address_id, get_default_pincode,\
|
| 11 |
create_user_communication, get_user_communication_by_id, get_user_communication_by_user, get_all_user_communications,\
|
11 |
create_user_communication, get_user_communication_by_id, get_user_communication_by_user, get_all_user_communications,\
|
| Line 13... |
Line 13... |
| 13 |
get_track_logs_by_user, get_track_logs, create_master_affiliate,\
|
13 |
get_track_logs_by_user, get_track_logs, create_master_affiliate,\
|
| 14 |
get_master_affiliate_by_id, get_master_affiliate_by_name, get_affiliates_by_master_affiliate, get_all_master_affiliates,\
|
14 |
get_master_affiliate_by_id, get_master_affiliate_by_name, get_affiliates_by_master_affiliate, get_all_master_affiliates,\
|
| 15 |
get_user_notes, put_user_note, get_my_research_items,\
|
15 |
get_user_notes, put_user_note, get_my_research_items,\
|
| 16 |
get_browse_history_items, update_my_research, delete_item_from_my_research,\
|
16 |
get_browse_history_items, update_my_research, delete_item_from_my_research,\
|
| 17 |
update_browse_history, get_user_by_mobile_number, is_alive, increase_trust_level,\
|
17 |
update_browse_history, get_user_by_mobile_number, is_alive, increase_trust_level,\
|
| 18 |
get_user_by_cart_id, get_trust_level, remove_user_communication
|
18 |
get_user_by_cart_id, get_trust_level, remove_user_communication,\
|
| - |
|
19 |
get_user_emails
|
| 19 |
|
20 |
|
| 20 |
from shop2020.model.v1.user.impl.CartDataAccessors import create_cart, get_cart,\
|
21 |
from shop2020.model.v1.user.impl.CartDataAccessors import create_cart, get_cart,\
|
| 21 |
get_cart_by_id, get_carts_between, add_item_to_cart,\
|
22 |
get_cart_by_id, get_carts_between, add_item_to_cart,\
|
| 22 |
add_address_to_cart, commit_cart,\
|
23 |
add_address_to_cart, commit_cart,\
|
| 23 |
validate_cart, merge_cart, delete_item_from_cart, check_out, reset_cart,\
|
24 |
validate_cart, merge_cart, delete_item_from_cart, check_out, reset_cart,\
|
| Line 29... |
Line 30... |
| 29 |
to_t_user_note
|
30 |
to_t_user_note
|
| 30 |
|
31 |
|
| 31 |
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
|
32 |
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
|
| 32 |
|
33 |
|
| 33 |
from shop2020.model.v1.user.impl import UserDataAccessors, CartDataAccessors
|
34 |
from shop2020.model.v1.user.impl import UserDataAccessors, CartDataAccessors
|
| - |
|
35 |
#from apport.hookutils import ret
|
| 34 |
|
36 |
|
| 35 |
class UserContextServiceHandler:
|
37 |
class UserContextServiceHandler:
|
| 36 |
|
38 |
|
| 37 |
|
39 |
|
| 38 |
def __init__(self, dbname='user', db_hostname='localhost'):
|
40 |
def __init__(self, dbname='user', db_hostname='localhost'):
|
| Line 812... |
Line 814... |
| 812 |
try:
|
814 |
try:
|
| 813 |
return add_store_to_cart(cartId, storeId)
|
815 |
return add_store_to_cart(cartId, storeId)
|
| 814 |
finally:
|
816 |
finally:
|
| 815 |
self.closeSession()
|
817 |
self.closeSession()
|
| 816 |
|
818 |
|
| - |
|
819 |
def getUserEmails(self, startDate, endDate):
|
| - |
|
820 |
'''
|
| - |
|
821 |
Get email addresses for users activated within a given date range
|
| - |
|
822 |
|
| - |
|
823 |
Parameters:
|
| - |
|
824 |
- startDate
|
| - |
|
825 |
- endDate
|
| - |
|
826 |
'''
|
| - |
|
827 |
try:
|
| - |
|
828 |
return get_user_emails(to_py_date(startDate), to_py_date(endDate))
|
| - |
|
829 |
finally:
|
| - |
|
830 |
self.closeSession()
|
| - |
|
831 |
|
| 817 |
def closeSession(self, ):
|
832 |
def closeSession(self, ):
|
| 818 |
CartDataAccessors.close_session()
|
833 |
CartDataAccessors.close_session()
|
| 819 |
UserDataAccessors.close_session()
|
834 |
UserDataAccessors.close_session()
|
| 820 |
|
835 |
|
| 821 |
def isAlive(self, ):
|
836 |
def isAlive(self, ):
|