1 ##############################################################################
2 # Copyright (c) 2015 Orange
3 # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 from ConfigParser import SafeConfigParser
13 parser = SafeConfigParser()
14 parser.read('config.ini')
17 mongo_url = parser.get('default', 'mongo_url')
21 def prepare_put_request(edit_request, key, new_value, old_value):
23 This function serves to prepare the elements in the update request.
24 We try to avoid replace the exact values in the db
25 edit_request should be a dict in which we add an entry (key) after
28 if not (new_value is None):
29 if len(new_value) > 0:
30 if new_value != old_value:
31 edit_request[key] = new_value