-
Notifications
You must be signed in to change notification settings - Fork 41
/
ginger.py
62 lines (53 loc) · 2.12 KB
/
ginger.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
#
# Project Ginger
#
# Copyright IBM Corp, 2014-2017
#
# 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 i18n import messages
from model import GingerModel
from wok import config
from wok.config import PluginConfig, PluginPaths
from wok.plugins.ginger.control import sub_nodes
from wok.root import WokRoot
class Ginger(WokRoot):
def __init__(self, wok_options=None):
object_store = config.get_object_store()
objstore_dir = os.path.dirname(os.path.abspath(object_store))
if not os.path.isdir(objstore_dir):
os.makedirs(objstore_dir)
self.model = GingerModel()
super(Ginger, self).__init__(self.model)
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.domain = "ginger"
self.depends = ['gingerbase']
self.messages = messages
self.paths = PluginPaths('ginger')
def get_custom_conf(self):
custom_config = PluginConfig('ginger')
custom_config.update({
'/help': {
'tools.staticdir.on': True,
'tools.nocache.on': True,
'tools.staticdir.dir': os.path.join(self.paths.ui_dir,
'pages/help')
}
})
return custom_config