Completed
Push — master ( 2b1567...aa9a3d )
by Daniel
08:37
created

WebPlugin   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 6 1
1
import logging
2
from groundwork.patterns import GwBasePattern
3
4
from groundwork_web.patterns.gw_web_pattern.provider import ProviderManagerApplication, ProviderManagerPlugin
5
from groundwork_web.patterns.gw_web_pattern.server import ServerManagerApplication, ServerManagerPlugin
6
7
8
class GwWebPattern(GwBasePattern):
9
10
    def __init__(self, *args, **kwargs):
11
        super().__init__(*args, **kwargs)
12
        if not hasattr(self.app, "web"):
13
            self.app.web = WebApplication(self.app)
14
15
        #: Instance of :class:`~.WebPlugin`.
16
        #: Provides functions to manage web based objects
17
        self.web = WebPlugin(self)
18
19
20
class WebPlugin:
21
    def __init__(self, plugin):
22
        self.plugin = plugin
23
        self.app = plugin.app
24
        self.log = plugin.log
25
        self.providers = ProviderManagerPlugin(self)
26
        self.servers = ServerManagerPlugin
27
28
29
class WebApplication:
30
    def __init__(self, app):
31
        self.app = app
32
        self.log = logging.getLogger(__name__)
33
        self.providers = ProviderManagerApplication(app)
34
        self.servers = ServerManagerApplication(app)
35
36
37
38