-
Notifications
You must be signed in to change notification settings - Fork 21
/
Core.py
32 lines (26 loc) · 960 Bytes
/
Core.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
import os
import importlib
from config import APP_PATH
"""
Class responsible for opening controllers
"""
class Core:
#-----------------------------------------------------------------------
# Methods
#-----------------------------------------------------------------------
"""
Given a controller name, return an instance of it
@param controller:string Controller to be opened
"""
@staticmethod
def openController(controller):
response = None
# Set controller name
controller = controller[0].upper()+controller[1:]
controllerName = controller+"Controller"
# Check if file exists
if os.path.exists(APP_PATH+"/controllers/"+controllerName+".py"):
module = importlib.import_module("controllers."+controllerName)
class_ = getattr(module, controllerName)
response = class_()
return response