Subversion Repositories SmartDukaan

Rev

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

Rev 14071 Rev 14076
Line 540... Line 540...
540
        mc.delete(userId)
540
        mc.delete(userId)
541
        return {1:'Cache cleared.'}
541
        return {1:'Cache cleared.'}
542
    except:
542
    except:
543
        return {0:'Unable to clear cache.'}
543
        return {0:'Unable to clear cache.'}
544
    
544
    
-
 
545
def updateCollection(data):
-
 
546
    try:
-
 
547
        collection = get_mongo_connection().Catalog[data['class']]
-
 
548
        data.pop('class')
-
 
549
        _id = data.pop('oid')
-
 
550
        collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
-
 
551
        #get_mongo_connection().Catalog.MasterData.update({'brand':data['brand'],'category_id':data['category_id']},{"$set":{'updatedOn':to_java_date(datetime.now())}},multi=True)
-
 
552
        return {1:"Data updated successfully"}
-
 
553
    except:
-
 
554
        return {0:"Data not updated."}
-
 
555
    
-
 
556
    
545
 
557
 
546
def main():
558
def main():
547
    x = getNewDeals(1, 0, 0, 500, None, None)
559
    x = getNewDeals(1, 0, 0, 500, None, None)
548
    for i in x:
560
    for i in x:
549
        print i['_id'],
561
        print i['_id'],