docklet/web/webViews/beansapplication.py

50 lines
1.5 KiB
Python
Raw Normal View History

2016-09-15 18:04:12 +08:00
from flask import session,render_template,request,redirect
from webViews.view import normalView
from webViews.dockletrequest import dockletRequest
class beansapplicationView(normalView):
template_path = "beansapplication.html"
@classmethod
def get(self):
result = dockletRequest.post('/beans/applymsgs/').get('applymsgs')
return self.render(self.template_path, applications = result)
@classmethod
def post(self):
return self.get()
2016-09-15 18:04:12 +08:00
class beansapplyView(normalView):
template_path = "error.html"
@classmethod
def post(self):
data = {"number":request.form["number"],"reason":request.form["reason"]}
result = dockletRequest.post('/beans/apply/',data)
success = result.get("success")
if success == "true":
return redirect("/beans/application/")
else:
return self.render(self.template_path, message = result.get("message"))
@classmethod
2016-09-15 18:04:12 +08:00
def get(self):
return self.post()
class beansadminView(normalView):
username = ""
msgid = ""
cmd = ""
template_path = "error.html"
@classmethod
def get(self):
data = {"username":self.username, "msgid":self.msgid}
result = dockletRequest.post('/beans/admin/'+self.cmd+"/",data)
success = result.get("success")
if success == "true":
return redirect("/user/list/")
else:
return self.render(self.template_path, message = result.get("message"))