Subversion Repositories SmartDukaan

Rev

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

Rev 3187 Rev 3192
Line 26... Line 26...
26
 
26
 
27
def get_providers():
27
def get_providers():
28
    providers = Provider.query.all()
28
    providers = Provider.query.all()
29
    return providers 
29
    return providers 
30
 
30
 
31
'''
-
 
32
Cache the return values of the function for one day
-
 
33
'''
-
 
34
@memoized(86400)
-
 
35
def is_cod_allowed(destination_pin):
31
def is_cod_allowed(destination_pin):
36
    try:
32
    try:
37
        sld = ServiceableLocationDetails.get_by(dest_pincode = destination_pin, cod = True)
33
        sld = ServiceableLocationDetails.get_by(dest_pincode = destination_pin, cod = True)
38
    except Exception as ex:
34
    except Exception as ex:
39
        print "Unexpected error:", sys.exc_info()[0]
35
        print "Unexpected error:", sys.exc_info()[0]
Line 41... Line 37...
41
    if sld:
37
    if sld:
42
        return True
38
        return True
43
    else:
39
    else:
44
        return False
40
        return False
45
 
41
 
46
'''
-
 
47
Cache the return values of the function for one day
-
 
48
'''
-
 
49
@memoized(86400)
-
 
50
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None, type=DeliveryType.PREPAID):
42
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None, type=DeliveryType.PREPAID):
51
    if warehouse_location is None:
43
    if warehouse_location is None:
52
        try:
44
        try:
53
            warehouse_location = WarehouseAllocation.get_by(pincode = destination_pin).primary_warehouse_location
45
            warehouse_location = WarehouseAllocation.get_by(pincode = destination_pin).primary_warehouse_location
54
        except:
46
        except:
Line 81... Line 73...
81
        return query.first()
73
        return query.first()
82
    except Exception as ex:
74
    except Exception as ex:
83
        print ex
75
        print ex
84
        raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
76
        raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
85
 
77
 
86
'''
-
 
87
Cache the return values of the function for one day
-
 
88
'''
-
 
89
@memoized(86400)
-
 
90
def __get_logistics_provider_for_destination_pincode(type, destination_pin):
78
def __get_logistics_provider_for_destination_pincode(type, destination_pin):
91
    try:
79
    try:
92
        sld = ServiceableLocationDetails.get_by(dest_pincode = destination_pin)
80
        sld = ServiceableLocationDetails.get_by(dest_pincode = destination_pin)
93
        if type == DeliveryType.PREPAID and sld.exp:
81
        if type == DeliveryType.PREPAID and sld.exp:
94
            provider = sld.provider
82
            provider = sld.provider