[Kimchi-devel] [PATCH 17/38] Setup wok
Lucio Correia
luciojhc at linux.vnet.ibm.com
Thu May 21 21:33:30 UTC 2015
- Add model.py for wok
- Disable wok authentication by default
---
src/wok/config.py.in | 1 +
src/wok/model/model.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
create mode 100644 src/wok/model/model.py
diff --git a/src/wok/config.py.in b/src/wok/config.py.in
index 4c97840..390ba3b 100644
--- a/src/wok/config.py.in
+++ b/src/wok/config.py.in
@@ -180,6 +180,7 @@ class UIConfig(dict):
ui_configs['/' + sub_dir] = {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(paths.ui_dir, sub_dir),
+ 'tools.wokauth.on': False,
'tools.nocache.on': False}
if sub_dir != 'images':
ui_configs['/' + sub_dir].update({
diff --git a/src/wok/model/model.py b/src/wok/model/model.py
new file mode 100644
index 0000000..09c4c1e
--- /dev/null
+++ b/src/wok/model/model.py
@@ -0,0 +1,49 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014-2015
+#
+# 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 inspect
+import os
+
+from wok.basemodel import BaseModel
+from wok.objectstore import ObjectStore
+from wok.utils import import_module, listPathModules
+
+
+class Model(BaseModel):
+ def __init__(self, objstore_loc=None):
+
+ self.objstore = ObjectStore(objstore_loc)
+ kargs = {'objstore': self.objstore}
+
+ this = os.path.basename(__file__)
+ this_mod = os.path.splitext(this)[0]
+
+ models = []
+ for mod_name in listPathModules(os.path.dirname(__file__)):
+ if mod_name.startswith("_") or mod_name == this_mod:
+ continue
+
+ module = import_module('wok.model.' + mod_name)
+ members = inspect.getmembers(module, inspect.isclass)
+ for cls_name, instance in members:
+ if inspect.getmodule(instance) == module:
+ if cls_name.endswith('Model'):
+ models.append(instance(**kargs))
+
+ return super(Model, self).__init__(models)
--
1.7.1
More information about the Kimchi-devel
mailing list