urls.py
****************************
# -*- coding: utf-8 -*-
from kay.routing import (ViewGroup, Rule)
view_groups = [ViewGroup(
Rule('/<app_name>/<module_name>/<method_name>/', endpoint='index', view='rami.app_index.index'),
Rule('/<app_name>/<module_name>/', endpoint='index', view='rami.app_index.index'),
Rule('/<app_name>/', endpoint='index', view='rami.app_index.index'),
Rule('/', endpoint='index', view='rami.app_index.index')
)]
****************************
app_index.py
****************************
# -*- coding: utf-8 -*-
from kay.utils import render_to_response
import mlib.appIndexExt as ai #端末情報取得などの関数群
def index(request, app_name=None, module_name=None, method_name=None):
response = {}
theme = 'default'
app = app_name if app_name in ['system','admin','master'] else 'user'
if app_name == 'apis':
module = app_name if app_name else 'index'
method = module_name if module_name else 'index'
elif app == 'user':
module = app_name if app_name else 'index'
method = module_name if module_name else 'index'
else:
module = module_name if module_name else 'index'
method = method_name if method_name else 'index'
#情報追加処理
hard = ai.addInfoDiverse() #端末情報格納
lang = ai.addInfoLanguage() #言語情報格納
response['method_id'] = method
response['hard'] = hard
response['lang'] = lang
html_path = 'rami/'+app+'/'+hard+'/'+ theme +'/'+lang
a = 'import rami.'+ module +'.'+ module+'_'+app +' as bas'
b = 'response = bas.'+ method +'(request,render_to_response,html_path,response)'
try :
exec a #import実行
exec b #method実行
except:
response = 0
return response
****************************
cmsp_user.py
****************************
# -*- coding: utf-8 -*-