- kv = orm.KeyValue(
- key = sx2osqa_set_map[set['name']],
- value = dbsafe_encode(html_decode(set['value']))
- )
+ try:
+ kv = orm.KeyValue.objects.get(key=sx2osqa_set_map[set['name']])
+ kv.value = dbsafe_encode(html_decode(set['value']))
+ except:
+ kv = orm.KeyValue(
+ key = sx2osqa_set_map[set['name']],
+ value = dbsafe_encode(html_decode(set['value']))
+ )