예제 #1
0
    def GET(self):
        if not session.get('logged_in', False):
            raise web.HTTPError("401 unauthorized", {}, "unauthorized")

        web.header('Content-Type', 'application/json')
        todos = model.get_todos()
        return json.dumps(todos.list())
예제 #2
0
파일: todo.py 프로젝트: liuyang1/test
 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('/')
예제 #3
0
파일: todo.py 프로젝트: kennyfrc/pybasics
 def GET(self):
     """ Show page """
     todos = model.get_todos(
     )  # returns an iterbetter object where u can iterate on it
     form = self.form()  # returns a form object which prints html
     return render.index(
         todos, form)  # print the index which contains todos and form
예제 #4
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('/')
예제 #5
0
파일: todo.py 프로젝트: kennyfrc/pybasics
 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)
예제 #6
0
 def GET(self):
     if session.get('logged_in', False):
         """ Show page """
         todos = model.get_todos()
         form = self.form()
         return render.index(todos, form)
     else:
         raise web.seeother('/login')
예제 #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("/")
예제 #8
0
 def GET(self, name):
     def default(o):
         return o.__dict__
     todos = model.get_todos()
     if not name: 
         name = 'World'
         
     return json.dumps(lista, default=default,indent=4)
예제 #9
0
파일: todo.py 프로젝트: neilxp/sk
 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('/')
예제 #10
0
 def GET(self):
     """ Show page """
     if session.get('loggedin') == True:
         usrname = session.username
         todos = model.get_todos(usrname)
         return render.index(todos, usrname)
     else:
         return web.seeother('/')
예제 #11
0
 def GET(self):
     """ Show page """
     if session.get('loggedin')==True:
        todos = model.get_todos()
        usrname=session.username
        return render.index(todos, usrname)
     else:
        return web.seeother('/')
예제 #12
0
파일: todo.py 프로젝트: michellechsy/python
 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)
예제 #13
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('/')对页面进行跳转
예제 #14
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')
예제 #15
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')
예제 #16
0
파일: todo.py 프로젝트: nianyuguai/Python
 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')
예제 #17
0
파일: todo.py 프로젝트: nianyuguai/Python
    def GET(self):
        '''Show Page'''
#         获取IP
#         ip = web.ctx.ip
#         print ip
#         print path
        todos = model.get_todos()
        form = self.form()
        form.inputs[1].value = None
        return render.admin(todos,form)
예제 #18
0
파일: todo.py 프로젝트: nianyuguai/Python
    def GET(self):
        '''Show Page'''
#         获取IP
#         ip = web.ctx.ip
#         print ip
#         print path
        todos = model.get_todos()
        form = self.form()
        form.inputs[1].value = None
#         for input in :
#             print input.value
#             input.value = None
#             print input.value
        print form.get('msg')
        return render.index(todos,form)
예제 #19
0
 def GET(self):
     """ Show page
     """
     todos = model.get_todos()
     form = self.form()
     return render.index(todos, form)
예제 #20
0
파일: todo.py 프로젝트: liuyang1/test
 def GET(self):
     todos = model.get_todos()
     form = self.form()
     return render.index(todos, form)
예제 #21
0
 def GET(self):
     """show page"""
     todos = model.get_todos()
     todos = todos if todos else [] #Ternary operator --> assign todos the value of todos if todos is a non-null value else make an empty list         
     form = self.form()
     return render.index(todos, form)
예제 #22
0
 def GET(self):
     """ Show page """
     todos = model.get_todos()
     return render.index(todos)
예제 #23
0
 def GET(self):
     '''Show page'''
     todos = model.get_todos()  # 通过model类的get_todos方法获取数据
     form = self.form()  # 引用前面实例化的form对象
     return render.index(todos, form)  # 将两个变量渲染到模版index网页中
예제 #24
0
파일: todo.py 프로젝트: axismagic/axis_todo
 def GET(self):
     debug = int(web.webapi.input(debug=0).debug)
     user = getUserbyIP()
     isqa = model.is_qa(user)
     todos = model.get_todos(debug)
     return render.index(todos, user, isqa, debug)
예제 #25
0
 def GET(self):
     todos=model.get_todos()
     form=self.form()
     return render.index(todos, form)
예제 #26
0
 def GET(self):
     """ Show page """
     todos = model.get_todos()
     form = self.form()
     return render.index(todos, form)