Subversion Repositories SmartDukaan

Rev

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

Rev 17541 Rev 17555
Line 2020... Line 2020...
2020
#     for x in uniqueMap.values():
2020
#     for x in uniqueMap.values():
2021
#         print count,
2021
#         print count,
2022
#         print '\t',
2022
#         print '\t',
2023
#         print x
2023
#         print x
2024
#         count = count+1
2024
#         count = count+1
2025
    
2025
 
2026
    print offset
2026
    print offset
2027
    print limit
2027
    print limit
2028
    
2028
    
2029
    return uniqueMap.values()[offset:limit+offset]
2029
    return uniqueMap.values()[offset:limit+offset]
2030
 
2030
 
Line 2058... Line 2058...
2058
            pass
2058
            pass
2059
    if returnMap['cheapest'] ==None:
2059
    if returnMap['cheapest'] ==None:
2060
        dum = get_mongo_connection().Catalog.MasterData.find_one({'skuBundleId':skuBundleId,'source_id':{"$in":SOURCE_MAP.keys()}})
2060
        dum = get_mongo_connection().Catalog.MasterData.find_one({'skuBundleId':skuBundleId,'source_id':{"$in":SOURCE_MAP.keys()}})
2061
        returnMap['cheapest'] = {'thumbnail':dum['thumbnail'],'source_product_name':dum['source_product_name']}
2061
        returnMap['cheapest'] = {'thumbnail':dum['thumbnail'],'source_product_name':dum['source_product_name']}
2062
    return returnMap
2062
    return returnMap
-
 
2063
 
-
 
2064
def addDealObject(data):
2063
      
2065
    try:
-
 
2066
        max_id = list(get_mongo_connection().Catalog.DealObject.find().sort([('_id',pymongo.DESCENDING)]).limit(1))
-
 
2067
        if len(max_id) ==0:
-
 
2068
            max_id = 0
-
 
2069
        data['_id'] = data['max_id']+1
-
 
2070
        get_mongo_connection().Catalog.DealObject.insert(data)
-
 
2071
        return {1:'Data added successfully'}
-
 
2072
    except:
-
 
2073
        return {0:'Error in adding data'}
-
 
2074
 
2064
def main():
2075
def main():
2065
    featuredDeals = mc.get("featured_deals")
-
 
2066
    print resetCache("47")
2076
    data = {'hello':"ya"}
2067
    print datetime.now()
2077
    addDealObject(data)
2068
    x=  getNewDeals(47, 6, 0, 20, None, None, None)
-
 
2069
    from bson.json_util import dumps
-
 
2070
    print dumps(x)
-
 
2071
    print datetime.now()
-
 
2072
 
2078
 
2073
        
2079
        
2074
 
2080
 
2075
if __name__=='__main__':
2081
if __name__=='__main__':
2076
    main()
2082
    main()