melon/handler.py

45 lines
1.2 KiB
Python
Raw Normal View History

2022-08-17 14:09:00 +07:00
import cherrypy
import json
import config.globalvar as globalvar
import config.template as pages
import modules.user.home as user_home
import modules.user.portal as user_portal
import modules.api.portal.add as api_portal_add
class handler(pages.main):
def __init__(self):
pages.main.__init__(self)
def index(self, **kwargs):
kwargs["params_page"] = pages.main().user("home")
return user_home.main().html(kwargs)
index.exposed = True
def portal(self, **kwargs):
kwargs["params_page"] = pages.main().user("portal")
return user_portal.main().html(kwargs)
portal.exposed = True
class api(pages.main):
def __init__(self):
pages.main.__init__(self)
class portal(pages.main):
def add(self, **kwargs):
response = api_portal_add.main().result(kwargs)
if response["message_action"] == "success":
print ("Success")
raise cherrypy.HTTPRedirect('/?message=success')
else:
print ("Failed")
raise cherrypy.HTTPRedirect('/?message=failed')
add.exposed = True
portal=portal()
api=api()