Subversion Repositories SmartDukaan

Rev

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

Rev 15074 Rev 15075
Line 864... Line 864...
864
        collection = get_mongo_connection().Catalog[data['class']]
864
        collection = get_mongo_connection().Catalog[data['class']]
865
        class_name = data.pop('class')
865
        class_name = data.pop('class')
866
        _id = data.pop('oid')
866
        _id = data.pop('oid')
867
        record = list(collection.find({'_id':ObjectId(_id)}))
867
        record = list(collection.find({'_id':ObjectId(_id)}))
868
        collection.remove({'_id':ObjectId(_id)})
868
        collection.remove({'_id':ObjectId(_id)})
-
 
869
        if class_name != "Notifications":
869
        if class_name !="CategoryDiscount":
870
            if class_name !="CategoryDiscount":
870
            get_mongo_connection().Catalog.MasterData.update({'_id':record[0]['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}})
871
                get_mongo_connection().Catalog.MasterData.update({'_id':record[0]['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}})
871
        else:
872
            else:
872
            get_mongo_connection().Catalog.MasterData.update({'brand':re.compile(record[0]['brand'], re.IGNORECASE),'category_id':record[0]['category_id']}, \
873
                get_mongo_connection().Catalog.MasterData.update({'brand':re.compile(record[0]['brand'], re.IGNORECASE),'category_id':record[0]['category_id']}, \
873
                                                             {"$set":{'updatedOn':to_java_date(datetime.now())}},upsert=False,multi=True)
874
                                                                 {"$set":{'updatedOn':to_java_date(datetime.now())}},upsert=False,multi=True)
874
        return {1:"Document deleted successfully"}
875
        return {1:"Document deleted successfully"}
875
    except Exception as e:
876
    except Exception as e:
876
        print e
877
        print e
877
        return {0:"Document not deleted."}
878
        return {0:"Document not deleted."}
878
 
879