Changeset - 7ac4571a15fd
[Not reviewed]
0 2 0
Lance Edgar (lance) - 2 months ago 2024-08-20 16:01:27
lance@edbob.org
fix: suppress warning when checking for legacy `app_package` config
2 files changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rattail/app.py
Show inline comments
 
@@ -150,7 +150,7 @@ class AppHandler(WuttaAppHandler):
 

	
 
        # if config has defined the (legacy) rattail.app_package
 
        # setting, use that (this is hacky but it works..)
 
        pkg = self.config.app_package(default='BOGUS')
 
        pkg = self.config.app_package(default='BOGUS', warn=False)
 
        if pkg != 'BOGUS':
 
            warnings.warn("config has a `rattail.app_package` setting, "
 
                          "but that is deprecated.  please set "
rattail/config.py
Show inline comments
 
@@ -356,11 +356,12 @@ class RattailConfig(WuttaConfig):
 
                      DeprecationWarning, stacklevel=2)
 
        return self.get_app().get_product_key_label(field=key)
 

	
 
    def app_package(self, default=None):
 
    def app_package(self, default=None, warn=True):
 
        """ """
 
        warnings.warn("config.app_package() method is deprecated; "
 
                      "please use app.get_distribution() instead",
 
                      DeprecationWarning, stacklevel=2)
 
        if warn:
 
            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)
0 comments (0 inline, 0 general)