diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-04-19 12:44:28 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-04-19 12:44:28 -0400 |
commit | c9da67b5170b473895ce83feba2aa328cf5ec9f8 (patch) | |
tree | d932414a83ed58ca0ad3f153a3173dc5e5eb2c84 /cobbler/api.py | |
parent | d7e488931d1c28f9f0693b7eaebe26bea19f72c5 (diff) | |
download | third_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/api.py')
-rw-r--r-- | cobbler/api.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cobbler/api.py b/cobbler/api.py index cda4e86..212305a 100644 --- a/cobbler/api.py +++ b/cobbler/api.py @@ -26,14 +26,21 @@ import cexceptions class BootAPI: + __shared_state = {} + has_loaded = False + def __init__(self): """ Constructor """ - self._config = config.Config(self) - self.deserialize() - self.__settings = self._config.settings() - self.sync_flag = self.__settings.minimize_syncs + + self.__dict__ = self.__shared_state + if not BootAPI.has_loaded: + BootAPI.has_loaded = True + self._config = config.Config(self) + self.deserialize() + self.__settings = self._config.settings() + self.sync_flag = self.__settings.minimize_syncs def clear(self): """ |