summaryrefslogtreecommitdiffstats
path: root/cobbler/config.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-19 12:44:28 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-19 12:44:28 -0400
commitc9da67b5170b473895ce83feba2aa328cf5ec9f8 (patch)
treed932414a83ed58ca0ad3f153a3173dc5e5eb2c84 /cobbler/config.py
parentd7e488931d1c28f9f0693b7eaebe26bea19f72c5 (diff)
downloadthird_party-cobbler-c9da67b5170b473895ce83feba2aa328cf5ec9f8.tar.gz
third_party-cobbler-c9da67b5170b473895ce83feba2aa328cf5ec9f8.tar.xz
third_party-cobbler-c9da67b5170b473895ce83feba2aa328cf5ec9f8.zip
Various improvements to make the API more usable and cobbler a bit
more efficient. Make both the Config and BootAPI objects Borgs, to prevent duplicate configuration records. Also do not implicitly serialize configuration objects unless the with_copy parameter is used.
Diffstat (limited to 'cobbler/config.py')
-rw-r--r--cobbler/config.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/cobbler/config.py b/cobbler/config.py
index 3444ded..3a9bd79 100644
--- a/cobbler/config.py
+++ b/cobbler/config.py
@@ -30,11 +30,25 @@ import serializer
class Config:
+ has_loaded = False
+ __shared_state = {}
+
+
def __init__(self,api):
+
"""
Constructor. Manages a definitive copy of all data collections with weakrefs
- poiting back into the class so they can understand each other's contents
+ pointing back into the class so they can understand each other's contents
"""
+ self.__dict__ == Config.__shared_state
+ if not Config.has_loaded:
+ self.__load(api)
+
+
+ def __load(self,api):
+
+ Config.has_loaded = True
+
self.api = api
self._distros = distros.Distros(weakref.proxy(self))
self._profiles = profiles.Profiles(weakref.proxy(self))