Changeset - 9421fe3aef72
[Not reviewed]
0 2 0
Lance Edgar (lance) - 2 months ago 2024-08-19 14:23:25
lance@edbob.org
fix: deprecate more methods for config object
2 files changed with 19 insertions and 19 deletions:
0 comments (0 inline, 0 general)
rattail/app.py
Show inline comments
 
@@ -141,8 +141,14 @@ class AppHandler(WuttaAppHandler):
 

	
 
    def get_version(self, **kwargs):
 
        """ """
 

	
 
        # first try standard logic
 
        version = super().get_version(**kwargs)
 
        if version:
 
            return version
 

	
 
        # if config has defined the (legacy) rattail.app_package
 
        # setting, just use that (this is hacky but it works..)
 
        # setting, use that (this is hacky but it works..)
 
        pkg = self.config.app_package(default='BOGUS')
 
        if pkg != 'BOGUS':
 
            warnings.warn("config has a `rattail.app_package` setting, "
 
@@ -152,9 +158,6 @@ class AppHandler(WuttaAppHandler):
 
            mod = importlib.import_module(pkg)
 
            return mod.__version__
 

	
 
        # otherwise use upstream logic
 
        return super().get_version(**kwargs)
 

	
 
    def get_class_prefix(self, default=None):
 
        """
 
        Returns the "class prefix" for the app, used when naming model
rattail/config.py
Show inline comments
 
@@ -357,30 +357,27 @@ class RattailConfig(WuttaConfig):
 
        return self.get_app().get_product_key_label(field=key)
 

	
 
    def app_package(self, default=None):
 
        """
 
        Returns the name of Python package for the top-level app.
 
        """
 
        """ """
 
        warnings.warn("config.app_package() method is deprecated; "
 
                      "please use app.get_distribution() instead",
 
                      DeprecationWarning, stacklevel=2)
 
        if not default:
 
            return self.require('rattail', 'app_package')
 
        return self.get('rattail', 'app_package', default=default)
 

	
 
    def app_title(self, **kwargs):
 
        """
 
        DEPRECATED; use :meth:`rattail.app.AppHandler.get_title()`
 
        instead.
 
        """
 
        # TODO: should put a deprecation warning here, but it could
 
        # make things noisy for a while and i'm not ready for that
 
        """ """
 
        warnings.warn("config.app_title() method is deprecated; "
 
                      "please use app.get_title() instead",
 
                      DeprecationWarning, stacklevel=2)
 
        app = self.get_app()
 
        return app.get_title(**kwargs)
 

	
 
    def node_title(self, **kwargs):
 
        """
 
        DEPRECATED; use
 
        :meth:`rattail.app.AppHandler.get_node_title()` instead.
 
        """
 
        # TODO: should put a deprecation warning here, but it could
 
        # make things noisy for a while and i'm not ready for that
 
        """ """
 
        warnings.warn("config.node_title() method is deprecated; "
 
                      "please use app.get_node_title() instead",
 
                      DeprecationWarning, stacklevel=2)
 
        app = self.get_app()
 
        return app.get_node_title(**kwargs)
 

	
0 comments (0 inline, 0 general)