Subversion Repositories SmartDukaan

Rev

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

Rev 3064 Rev 3098
Line 12... Line 12...
12
    DeliveryType
12
    DeliveryType
13
from shop2020.utils.Utils import log_entry, to_py_date, to_java_date
13
from shop2020.utils.Utils import log_entry, to_py_date, to_java_date
14
from elixir import session
14
from elixir import session
15
import datetime, time
15
import datetime, time
16
import sys
16
import sys
-
 
17
from shop2020.utils.caching.SimpleCaching import memoized
17
 
18
 
18
def initialize(dbname="logistics"):
19
def initialize(dbname="logistics"):
19
    log_entry("initialize@DataAccessor", "Initializing data service")
20
    log_entry("initialize@DataAccessor", "Initializing data service")
20
    DataService.initialize(dbname)
21
    DataService.initialize(dbname)
21
 
22
 
Line 35... Line 36...
35
    
36
    
36
    if sld:
37
    if sld:
37
        return True
38
        return True
38
    else:
39
    else:
39
        return False
40
        return False
40
    
-
 
41
 
41
 
-
 
42
'''
-
 
43
Cache the return values of the function for one hour
-
 
44
'''
-
 
45
@memoized(3600)
42
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None, type=DeliveryType.PREPAID):
46
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None, type=DeliveryType.PREPAID):
43
    if warehouse_location is None:
47
    if warehouse_location is None:
44
        try:
48
        try:
45
            warehouse_location = WarehouseAllocation.get_by(pincode = destination_pin).primary_warehouse_location
49
            warehouse_location = WarehouseAllocation.get_by(pincode = destination_pin).primary_warehouse_location
46
        except:
50
        except: