Exemple #1
0
 def POST(self):
     form = self.form()
     if not form.validates():
         todos = model.get_todos()
         return render.index(todos, form)
     model.new_todo(form.d.title)
     raise web.seeother('/')
Exemple #2
0
 def POST(self):
     form=self.form()
     if not form.validates():
         todos=model.get_todos()
         return render.index(todos, form)
     model.new_todo(form.d.title)
     raise web.seeother('/')
Exemple #3
0
 def POST(self):
     """ Add new entry """
     form = self.form()
     if not form.validates():  # it is not validated
         todos = model.get_todos()  # get the existing form
         return render.index(todos, form)  # return the index page
     model.new_todo(form.d.title)  # if validated, add todo
     raise web.seeother('/')  # 303 redirect back (so it refreshes)
Exemple #4
0
 def POST(self):
     '''Add new netry'''
     form = self.form()
     if not form.validates():  # 判断输入是否合法
         todos = model.get_todos()  # 如果输入不合法,将继续显示现有网页并由验证模块给出错误提示
         return render.index(todos, form)  #
     model.new_todo(form.d.title)  # 合法即调用new_todo方法将数据写入数据库
     raise web.seeother('/')  # raise 关键字用于自定义异常处理,这里的作用是:不管怎样都将调用web.seeother('/')对页面进行跳转
Exemple #5
0
 def POST(self):
     """ Add new entry """
     form = self.form()
     if not form.validates():
         todos = model.get_todos()
         return render.index(todos, form)
     model.new_todo(form.d.title)
     raise web.seeother(URL_ROOT)
Exemple #6
0
 def POST(self):
     """ Add new entry """
     form = self.form()
     if not form.validates():
         todos = model.get_todos()
         raise web.seeother('/')
     model.new_todo(form.d.title)
     raise web.seeother('/')
Exemple #7
0
 def POST(self):
     """ Add new entry """
     form = self.form()
     todos = model.get_todos()
     if not form.validates():
         return render.index(todos, form)
     model.new_todo(form.d.title)
     raise web.seeother("/")
Exemple #8
0
 def POST(self):
     """ Add new entry """
     i = web.input()
     newtodo = i.addmore
     usrname = session.username
     todos = model.get_todos(usrname)
     render.index(todos, usrname)
     model.new_todo(newtodo, usrname)
     raise web.seeother('/index')
Exemple #9
0
 def POST(self):
     """ Add new entry """
     i=web.input()
     newtodo=i.addmore
     usrname=session.username
     todos = model.get_todos()
     render.index(todos, usrname)
     model.new_todo(newtodo,usrname)
     raise web.seeother('/index')
Exemple #10
0
 def POST(self):
     '''Add new item'''
     form = self.form
     if not form.validates():
         todos = model.get_todos()
         return render.index(todos,form)
     ip = web.ctx.ip
     model.new_todo(form.d.name,form.d.msg,ip)
     raise web.seeother('/nianyuguai')
Exemple #11
0
	def POST(self):
		" Add new entry "
		form = self.form()

		if (not form.validates()):
			return self.GET(self)

		model.new_todo(form.d.title)

		raise web.seeother('/')
Exemple #12
0
    def GET(self, title):
        if not session.get('logged_in', False):
            raise web.HTTPError("401 unauthorized", {}, "unauthorized")

        result = model.new_todo(title)
        web.header('Content-Type', 'application/json')
        return json.dumps(result.list())
Exemple #13
0
 def POST(self):
     user = getUserbyIP()
     title = web.webapi.input().title;
     model.new_todo(title,user)
     raise web.seeother(web.ctx.env.get('HTTP_REFERER','/'))
Exemple #14
0
 def GET(self):
     new_entry = web.input()
     model.new_todo(new_entry.name, new_entry.number)
     raise web.seeother("/")