Use a property to implement portdbapi.settings.
authorZac Medico <zmedico@gentoo.org>
Fri, 26 Jun 2009 23:38:01 +0000 (23:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 26 Jun 2009 23:38:01 +0000 (23:38 -0000)
svn path=/main/trunk/; revision=13703

pym/portage/dbapi/porttree.py

index e55db14871d3320e34cce5653b5282d45388fe4f..7c886ae259272d005c3186bb8384cbd3d2e91095 100644 (file)
@@ -110,6 +110,20 @@ class portdbapi(dbapi):
        """this tree will scan a portage directory located at root (passed to init)"""
        portdbapi_instances = []
        _use_mutable = True
+
+       def _get_settings(self):
+               return self.mysettings
+
+       def _set_settings(self, settings):
+               self.mysettings = settings
+
+       def _del_settings (self):
+               del self.mysettings
+
+       settings = property(_get_settings, _set_settings, _del_settings,
+               "Define self.settings as an alias for self.mysettings, " + \
+               "for conformity with other dbapi classes.")
+
        def __init__(self, porttree_root, mysettings=None):
                portdbapi.portdbapi_instances.append(self)
 
@@ -119,8 +133,6 @@ class portdbapi(dbapi):
                else:
                        from portage import settings
                        self.mysettings = config(clone=settings)
-               # Define self.settings, for conformity with other dbapi classes.
-               self.settings = self.mysettings
                self._iuse_implicit = self.mysettings._get_implicit_iuse()
                self._categories = self.mysettings.categories
                # This is strictly for use in aux_get() doebuild calls when metadata