deep copy config before manipulating it
This commit is contained in:
parent
81ac4826e4
commit
7f722a40c4
2 changed files with 5 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import copy
|
||||||
|
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
@ -54,7 +55,7 @@ def init(request):
|
||||||
'''
|
'''
|
||||||
#data = json.loads(request.POST['data'])
|
#data = json.loads(request.POST['data'])
|
||||||
response = json_response({})
|
response = json_response({})
|
||||||
config = settings.CONFIG.copy()
|
config = copy.deepcopy(settings.CONFIG)
|
||||||
del config['keys'] #is this needed?
|
del config['keys'] #is this needed?
|
||||||
|
|
||||||
#populate max values for percent requests
|
#populate max values for percent requests
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
import copy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
@ -29,7 +30,7 @@ class UserProfile(models.Model):
|
||||||
|
|
||||||
def get_ui(self):
|
def get_ui(self):
|
||||||
ui = {}
|
ui = {}
|
||||||
config = settings.CONFIG.copy()
|
config = copy.deepcopy(settings.CONFIG)
|
||||||
ui.update(config['user']['ui'])
|
ui.update(config['user']['ui'])
|
||||||
def updateUI(ui, new):
|
def updateUI(ui, new):
|
||||||
'''
|
'''
|
||||||
|
@ -44,7 +45,7 @@ class UserProfile(models.Model):
|
||||||
ui = updateUI(ui, self.ui)
|
ui = updateUI(ui, self.ui)
|
||||||
if not 'lists' in ui:
|
if not 'lists' in ui:
|
||||||
ui['lists'] = {}
|
ui['lists'] = {}
|
||||||
ui['lists'][''] = config['uiDefaults']['list']
|
ui['lists'][''] = copy.deepcopy(config['user']['ui']['lists'][''])
|
||||||
|
|
||||||
def add(lists, section):
|
def add(lists, section):
|
||||||
ids = []
|
ids = []
|
||||||
|
|
Loading…
Reference in a new issue