From 8fb8a77dcad4aa657b7ddb637459a6279a21755e Mon Sep 17 00:00:00 2001 From: uggla Date: Fri, 10 Jul 2015 12:11:22 +0200 Subject: [PATCH] Copy reference object example. This commit is just implemented to validate the medhod. But this is not conveniant, because reference models must not be changed. So next step is to make them private attributes. --- alexandria/drivers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/alexandria/drivers.py b/alexandria/drivers.py index ab4bd22..4b2d162 100644 --- a/alexandria/drivers.py +++ b/alexandria/drivers.py @@ -1,6 +1,7 @@ # coding=utf-8 import types +import pprint import config @@ -57,8 +58,14 @@ class Fakeprovider(Driver): # Now create a manager model from reference model. ci.ci_type = "Manager" - ci.data = config.alexandria.model.Manager + ci.data = config.alexandria.model.Manager.copy() + + if ci.data is config.alexandria.model.Manager: + print "identical" + pp = pprint.PrettyPrinter(indent=4) + + pp.pprint(ci.data) class DriverCollection(list): pass