Total Complexity | 8 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # coding=utf-8 |
||
2 | from __future__ import absolute_import |
||
3 | |||
4 | import logging |
||
5 | |||
6 | from octoprint.plugin import SettingsPlugin as OctoPrintSettingPlugin |
||
7 | |||
8 | |||
9 | class SettingsPlugin(OctoPrintSettingPlugin): |
||
10 | @property |
||
11 | def settings(self): |
||
12 | return self._settings |
||
13 | |||
14 | @property |
||
15 | def identifier(self): |
||
16 | return self._identifier |
||
17 | |||
18 | @property |
||
19 | def logger(self): |
||
20 | if "_logger" in self.__dict__: |
||
21 | return self._logger |
||
22 | else: |
||
23 | # FIXME vexingly, sometimes we want to log things before the logger is injected |
||
24 | return logging.getLogger("octoprint.plugins.auth_ldap") |
||
25 | |||
26 | |||
27 | class DependentOnSettingsPlugin: |
||
28 | def __init__(self, plugin): |
||
29 | self._plugin = plugin |
||
30 | |||
31 | @property |
||
32 | def plugin(self): |
||
33 | return self._plugin |
||
34 | |||
35 | @property |
||
36 | def logger(self): |
||
37 | return self._plugin.logger |
||
38 | |||
39 | @property |
||
40 | def settings(self): |
||
41 | return self._plugin.settings |
||
42 |