Subversion Repositories SmartDukaan

Rev

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

Rev 3144 Rev 3145
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)
31
def is_cod_allowed(destination_pin):
35
def is_cod_allowed(destination_pin):
32
    try:
36
    try:
33
        sld = ServiceableLocationDetails.get_by(dest_pincode = destination_pin, cod = True)
37
        sld = ServiceableLocationDetails.get_by(dest_pincode = destination_pin, cod = True)
34
    except Exception as ex:
38
    except Exception as ex:
35
        print "Unexpected error:", sys.exc_info()[0]
39
        print "Unexpected error:", sys.exc_info()[0]
Line 38... Line 42...
38
        return True
42
        return True
39
    else:
43
    else:
40
        return False
44
        return False
41
 
45
 
42
'''
46
'''
43
Cache the return values of the function for one hour
47
Cache the return values of the function for one day
44
'''
48
'''
45
@memoized(86400)
49
@memoized(86400)
46
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None, type=DeliveryType.PREPAID):
50
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None, type=DeliveryType.PREPAID):
47
    if warehouse_location is None:
51
    if warehouse_location is None:
48
        try:
52
        try:
Line 130... Line 134...
130
    awb = Awb.get_by(awb_number = awb_number, provider_id = provider_id)
134
    awb = Awb.get_by(awb_number = awb_number, provider_id = provider_id)
131
    query = AwbUpdate.query.filter_by(awb = awb)
135
    query = AwbUpdate.query.filter_by(awb = awb)
132
    info = query.all()
136
    info = query.all()
133
    return info
137
    return info
134
 
138
 
-
 
139
'''
-
 
140
Cache the return values of the function for one day
-
 
141
'''
-
 
142
@memoized(86400)
135
def get_holidays(start_date, end_date):
143
def get_holidays(start_date, end_date):
136
    query = PublicHolidays.query
144
    query = PublicHolidays.query
137
    if start_date != -1:
145
    if start_date != -1:
138
        query = query.filter(PublicHolidays.date >= to_py_date(start_date))
146
        query = query.filter(PublicHolidays.date >= to_py_date(start_date))
139
    if end_date != -1:
147
    if end_date != -1: