-
Notifications
You must be signed in to change notification settings - Fork 8
/
gingers390x.py
65 lines (54 loc) · 2.3 KB
/
gingers390x.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Project Ginger S390x
#
# Copyright IBM Corp, 2015-2016
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import json
import os
from wok.root import WokRoot
from wok.plugins.gingers390x import config, mockmodel
from wok.plugins.gingers390x.i18n import messages
from wok.plugins.gingers390x.control import sub_nodes
from wok.plugins.gingers390x.model import model as gingerS390xModel
class Gingers390x(WokRoot):
def __init__(self, wok_options):
make_dirs = [
os.path.dirname(os.path.abspath(config.get_object_store())),
]
for directory in make_dirs:
if not os.path.isdir(directory):
os.makedirs(directory)
if hasattr(wok_options, "model"):
self.model = wok_options.model
elif wok_options.test:
self.model = mockmodel.MockModel()
else:
self.model = gingerS390xModel.Model()
dev_env = wok_options.environment != 'production'
super(Gingers390x, self).__init__(self.model, dev_env)
for ident, node in sub_nodes.items():
setattr(self, ident, node(self.model))
self.api_schema = json.load(open(os.path.join(os.path.dirname(
os.path.abspath(__file__)), 'API.json')))
self.paths = config.gingerS390xPaths
self.domain = 'gingers390x'
self.messages = messages
self.extends = {"/plugins/ginger": {
"host-storage.html": "plugins/gingers390x/js/gingers390x.min.js",
"host-network.html": "plugins/gingers390x/js/gingers390x.min.js"}
}
def get_custom_conf(self):
return config.GingerS390xConfig()