Subversion Repositories SmartDukaan

Rev

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

Rev 3557 Rev 4295
Line 1... Line 1...
1
'''
1
'''
2
Created on 23-Mar-2010
2
Created on 23-Mar-2010
3
 
3
 
4
@author: ashish
4
@author: ashish
5
'''
5
'''
6
from shop2020.thriftpy.model.v1.catalog.ttypes import  Item,\
6
from shop2020.thriftpy.model.v1.catalog.ttypes import  Item, ItemInventory, Warehouse, VendorItemPricing, Vendor, Category,\
7
    ItemInventory, Warehouse, VendorItemPricing, Vendor, Category,\
7
    VendorItemMapping, SourceItemPricing, Source, ProductNotificationRequest as TProductNotificationRequest,\
8
    VendorItemMapping, SourceItemPricing, Source
8
    ProductNotificationRequestCount as TProductNotificationRequestCount
9
import time
9
import time
10
from shop2020.utils.Utils import to_java_date
10
from shop2020.utils.Utils import to_java_date
11
 
11
 
12
def to_t_item(item):
12
def to_t_item(item):
13
    t_item = Item()
13
    t_item = Item()
Line 51... Line 51...
51
    t_item.otherInfo = to_t_other_info(item)
51
    t_item.otherInfo = to_t_other_info(item)
52
    t_item.bestSellingRank = item.bestSellingRank
52
    t_item.bestSellingRank = item.bestSellingRank
53
    t_item.risky = item.risky
53
    t_item.risky = item.risky
54
    t_item.expectedDelay = item.expectedDelay
54
    t_item.expectedDelay = item.expectedDelay
55
    t_item.preferredWarehouse = item.preferredWarehouse
55
    t_item.preferredWarehouse = item.preferredWarehouse
-
 
56
    t_item.warrantyPeriod = item.warranty_period
56
    
57
    
57
    return t_item
58
    return t_item
58
 
59
 
59
def to_t_other_info(item):
60
def to_t_other_info(item):
60
    t_other_info = {}
61
    t_other_info = {}
Line 135... Line 136...
135
    t_source = Source()
136
    t_source = Source()
136
    t_source.id = source.id
137
    t_source.id = source.id
137
    t_source.name = source.name
138
    t_source.name = source.name
138
    t_source.identifier = source.identifier
139
    t_source.identifier = source.identifier
139
    return t_source
140
    return t_source
-
 
141
 
-
 
142
def to_t_product_notification_request(product_notification_request):
-
 
143
    t_product_notification_request = TProductNotificationRequest()
-
 
144
    
-
 
145
    if product_notification_request:
-
 
146
        t_product_notification_request.item = to_t_item(product_notification_request.item)
-
 
147
        t_product_notification_request.email = product_notification_request.email
-
 
148
        t_product_notification_request.addedOn = to_java_date(product_notification_request.addedOn)
-
 
149
    
-
 
150
    return t_product_notification_request
-
 
151
 
-
 
152
def to_t_product_notification_request_count(product_notification_request_count):
-
 
153
    
-
 
154
    t_product_notification_request_count = TProductNotificationRequestCount()
-
 
155
    
-
 
156
    if product_notification_request_count:
-
 
157
        item, count = product_notification_request_count
-
 
158
        t_product_notification_request_count.item = to_t_item(item)
-
 
159
        t_product_notification_request_count.count = count
-
 
160
    
-
 
161
    return t_product_notification_request_count
140
162