|
|
|
@ -46,8 +46,10 @@ def _getHandler (app_id,resource=None) :
|
|
|
|
|
_id = _getId(app_id,resource)
|
|
|
|
|
|
|
|
|
|
return _route._apps[_id]
|
|
|
|
|
def _getId(app_id,resource):
|
|
|
|
|
return '/'.join([app_id,resource]) if resource else app_id
|
|
|
|
|
def _getId(app_id,app_x):
|
|
|
|
|
if app_x not in [None,''] :
|
|
|
|
|
return '/'.join([app_id,app_x])
|
|
|
|
|
return app_id
|
|
|
|
|
def _setHandler (app_id,resource) :
|
|
|
|
|
session['app_id'] = _getId(app_id,resource)
|
|
|
|
|
|
|
|
|
@ -96,33 +98,14 @@ def _getIndex (app_id ,resource=None):
|
|
|
|
|
@_app.route("/")
|
|
|
|
|
def _index ():
|
|
|
|
|
return _getIndex('main')
|
|
|
|
|
# def _xindex ():
|
|
|
|
|
# _handler = _getHandler()
|
|
|
|
|
# _config = _handler.config()
|
|
|
|
|
# global _route
|
|
|
|
|
|
|
|
|
|
# # print ([' serving ',session.get('app_id','NA'),_handler.layout()['root']])
|
|
|
|
|
# _args={'system':_handler.system(skip=['source','app','data']),'layout':_handler.layout()}
|
|
|
|
|
|
|
|
|
|
# try:
|
|
|
|
|
# uri = os.sep.join([_config['layout']['root'], _config['layout']['index']])
|
|
|
|
|
# _index_page = "index.html"
|
|
|
|
|
|
|
|
|
|
# _args = _route.render(uri,'index',session.get('app_id','main'))
|
|
|
|
|
# # _setHandler('main')
|
|
|
|
|
# except Exception as e:
|
|
|
|
|
# # print ()
|
|
|
|
|
# print (e)
|
|
|
|
|
# _index_page = "404.html"
|
|
|
|
|
|
|
|
|
|
# return render_template(_index_page,**_args),200 if _index_page != "404.html" else 200
|
|
|
|
|
|
|
|
|
|
@_app.route("/<app>/<resource>")
|
|
|
|
|
@_app.route("/<app>",defaults={'resource':None})
|
|
|
|
|
def _aindex (app,resource=None):
|
|
|
|
|
_handler = _getHandler(app,resource)
|
|
|
|
|
|
|
|
|
|
_setHandler(app,resource)
|
|
|
|
|
_html,_code = _getIndex(app,resource)
|
|
|
|
|
|
|
|
|
|
return _html,_code
|
|
|
|
|
# @_app.route('/id/<uid>')
|
|
|
|
|
# def people(uid):
|
|
|
|
@ -147,7 +130,7 @@ def _dialog (app):
|
|
|
|
|
|
|
|
|
|
@_app.route("/api/<module>/<name>",defaults={'app':'main','key':None},methods=['GET','POST','DELETE','PUT'])
|
|
|
|
|
@_app.route("/<app>/api/<module>/<name>",defaults={'key':None},methods=['GET','POST','DELETE','PUT'])
|
|
|
|
|
@_app.route("/<app>/<key>/<module>/<name>",defaults={'key':None},methods=['GET','POST','DELETE','PUT'])
|
|
|
|
|
@_app.route("/<app>/<key>/api/<module>/<name>",methods=['GET','POST','DELETE','PUT'])
|
|
|
|
|
|
|
|
|
|
def _delegate_call(app,key,module,name):
|
|
|
|
|
_handler = _getHandler(app,key)
|
|
|
|
|