muffin 0.96.2__tar.gz → 0.97.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: muffin
3
- Version: 0.96.2
3
+ Version: 0.97.1
4
4
  Summary: Muffin is a fast, simple and asyncronous web-framework for Python 3 (asyncio, trio, curio)
5
5
  Home-page: https://github.com/klen/muffin
6
6
  License: MIT
@@ -50,7 +50,7 @@ class BasePlugin(ABC):
50
50
  msg = "Plugin.name is required"
51
51
  raise TypeError(msg)
52
52
 
53
- self.cfg = Config(config_config={"update_from_env": False}, **self.defaults)
53
+ self.cfg = Config(config_config={"update_from_env": False}, disabled=False, **self.defaults)
54
54
  self.__app__ = app
55
55
 
56
56
  if app is not None:
@@ -74,8 +74,6 @@ class BasePlugin(ABC):
74
74
  """Bind app and update the plugin's configuration."""
75
75
  # allow to redefine the name for multi plugins with same type
76
76
  self.name = name or self.name
77
- self.__app__ = app
78
- app.plugins[self.name] = self
79
77
 
80
78
  # Update configuration
81
79
  self.cfg.update_from_dict(
@@ -84,6 +82,12 @@ class BasePlugin(ABC):
84
82
  exist_only=True,
85
83
  )
86
84
  self.cfg.update_from_dict(options)
85
+ if self.cfg.disabled:
86
+ app.logger.warning("Plugin %s is disabled", self.name)
87
+ return
88
+
89
+ app.plugins[self.name] = self
90
+ self.__app__ = app
87
91
 
88
92
  # Register a middleware
89
93
  if self.middleware:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "muffin"
3
- version = "0.96.2"
3
+ version = "0.97.1"
4
4
  description = "Muffin is a fast, simple and asyncronous web-framework for Python 3 (asyncio, trio, curio)"
5
5
  readme = "README.rst"
6
6
  license = "MIT"
File without changes
File without changes
@@ -75,10 +75,6 @@ class Application(BaseApp):
75
75
  self.manage = Manager(self)
76
76
 
77
77
  # Setup logging
78
- log_config = self.cfg.get("LOG_CONFIG")
79
- if log_config and isinstance(log_config, dict) and log_config.get("version"):
80
- dictConfig(log_config)
81
-
82
78
  self.logger = logging.getLogger("muffin")
83
79
  self.logger.setLevel(self.cfg.LOG_LEVEL)
84
80
  self.logger.propagate = False
@@ -89,6 +85,10 @@ class Application(BaseApp):
89
85
  )
90
86
  self.logger.addHandler(ch)
91
87
 
88
+ log_config = self.cfg.get("LOG_CONFIG")
89
+ if log_config and isinstance(log_config, dict) and log_config.get("version"):
90
+ dictConfig(log_config)
91
+
92
92
  super().__init__(
93
93
  debug=self.cfg.DEBUG,
94
94
  logger=self.logger,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes