python类seeother()的实例源码

website.py 文件源码 项目:Chinese-ChatBot-AIML-Web.py 作者: JingLuo05 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def POST(self):
        form = myform()
        if not form.validates():
            return render.formtest(form)
        else:
            # form.d.boe and form['boe'].value are equivalent ways of
            # extracting the validated arguments from the form.
            global question
            global answer
            global chat_history
            global after_question
            question = form['??'].value
            after_question = stopwords.eliminate_stop_words(question)
            answer = robot.chat(after_question)
            chat_history.append(question)
            chat_history.append(answer)

            if answer is "":
                raise web.seeother('/add')
            web.header('Content-Type','text/html; charset=utf-8', unique=True)  # let the browser use the utf-8 encoding
            form['??'].set_value('')
            return render.answer(answer,chat_history, form)
            # return "Grrreat success! boe: %s, bax: %s, area: %s" % (form.d.boe, form['bax'].value, form['moe'].value)
main.py 文件源码 项目:smartthings-monitor 作者: CNG 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def GET(self):
        log.debug('connect.GET')
        user = current_user()
        if user:
            log.debug('user is {0}'.format(user))
            st = smartthings.SmartThings()
            params = web.input()
            log.debug('params is {0}'.format(params))
            if 'code' in params:
                # We just logged into SmartThings and got an OAuth code.
                user['token'] = st.token(params)
                user[SHORT_KEY] = new_shortcode(
                    collection=users.collection,
                    keyname=SHORT_KEY,
                    )
                users.register(**user) #  not totally sure why need **
                result_url = '/data/{0}'.format(user[SHORT_KEY])
                raise web.seeother(result_url)
            else:
                # We are about to redirect to SmartThings to authorize.
                raise web.seeother(st.auth_url())
        else:
            log.error('/connect was accessed without a user session.')
            raise web.seeother('/error')
app_backup.py 文件源码 项目:MonopolyWeb 作者: zeal4u 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def POST(self):
        # one round end, so we enter game page in init status, stop user return back
        if Game.one_round_end:
            raise web.seeother('/game')

        if Game.service.next_turn():
            DBHelper.update_record(Game.service.current_player,Game.service.sum_turns,strftime("%Y-%m-%d %H:%M:%S", localtime(time())))

            messages = ["Player %s has won the game in %d turns. CONGRATULATIONS!" %
                        (Game.service.current_player.name,Game.service.sum_turns)]

            if DBHelper.record_is_broken(Game.service.sum_turns):
                plus = 'You Just Broken A Record! Have A Look!'
                messages.append(plus)

            # Current game finish
            Game.one_round_end = True

            return render.gameover(messages=messages)
        else:
            current_player = Game.service.current_player
            messages = Game.service.messages

        return render.game(current_player=current_player,messages=messages)
cosa_nostra.py 文件源码 项目:cosa-nostra 作者: joxeankoret 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def POST(self):
    if not 'user' in session or session.user is None:
        f = register_form()
        return render.login(f)

    i = web.input(id=None, description=None)
    cluster_id = i.id
    if cluster_id is None:
      return render.error("No cluster id specified.")

    if not cluster_id.isdigit():
      return render.error("Invalid number.")
    cluster_id = int(cluster_id)

    desc = i.description
    vars = {"id":cluster_id}

    db = open_db()
    db.update('clusters', vars=vars, where="id = $id", description=desc)

    raise web.seeother("/view_cluster?id=%d" % cluster_id)

#-----------------------------------------------------------------------
jsonserver.py 文件源码 项目:app-scripts 作者: Forkong 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def GET(self):
        time.sleep(sleep_time)
        # json
        raise web.seeother('/static/queryGroupInfo.json')
jsonserver.py 文件源码 项目:app-scripts 作者: Forkong 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def GET(self):
        time.sleep(sleep_time)
        # base64 json
        raise web.seeother('/static/queryGroupList_64.json')
app.py 文件源码 项目:LPTHW 作者: hairuo 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def GET(self):
        # this is used to "setup" the session with starting values
        session.room = map.START
        web.seeother("/game")
app.py 文件源码 项目:LPTHW 作者: hairuo 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def POST(self):
        form = web.input(action=None)

        # there is a bug here, can you fix it?
        if session.room and form.action:
            session.room = session.room.go(form.action)

        web.seeother("/game")
ChatBot.py 文件源码 项目:chat-bots-manager 作者: toxtli 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def GET(self):
            raise web.seeother('/static/index.html')
gravi_site.py 文件源码 项目:Gravimetrics 作者: NPPC-UK 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def GET(self, name=None):
        """
        This function processes the GET requests from the site
        """
        if name:
            print(name)

        data = web.input()
        print(data)

        if session.get('loggedin', None):
            f = plantsForm()
            return self.render.index(f, getTable)
        else:
            web.seeother('login')
gravi_site.py 文件源码 项目:Gravimetrics 作者: NPPC-UK 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def POST(self):
        """ 
        Called when the user enters login data
        """
        f = loginForm()
        if f.validates():
            session.loggedin = True
            data = web.input()
            if connection.create_connection(
                    data['Host'], data['User'], data['Password'], data['Database']) == 0:
                return web.seeother('/')
            else:
                return self.render.login(f)
        else:
            return self.render.login(f)
gravi_site.py 文件源码 项目:Gravimetrics 作者: NPPC-UK 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def GET(self):
        session.kill()
        web.seeother('/login')
login.py 文件源码 项目:Desert-Fireball-Maintainence-GUI 作者: CPedersen3245 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def login():
        """
        Logs the user in by manipulating their session.

        Raises:
             web.seeother: Raises the '/app' endpoint to the client.
        """
        session.logged_in = True

        raise web.seeother('/app')
logout.py 文件源码 项目:Desert-Fireball-Maintainence-GUI 作者: CPedersen3245 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def GET(self):
        """
        Logs the user out by manipulating their session.


        Raises:
            web.seeother: Raises the '/' endpoint to the client.
        """
        session.logged_in = False

        raise web.seeother('/')
login_checker.py 文件源码 项目:Desert-Fireball-Maintainence-GUI 作者: CPedersen3245 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def loggedIn():
        """
        Checks whether the user's session is logged in.

        Returns:
            True for logged in, or raises the / endpoint if not logged in.

        Raises:
            web.seeother: Raises the '/' endpoint if not logged in.
        """
        if session.get('logged_in', False):
            return True
        else:
            raise web.seeother('/')
main.py 文件源码 项目:webapi 作者: IntPassion 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def GET(self):       
        return web.seeother('static/index.html')
website.py 文件源码 项目:Chinese-ChatBot-AIML-Web.py 作者: JingLuo05 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def POST(self):
        raise web.seeother('/')
website.py 文件源码 项目:Chinese-ChatBot-AIML-Web.py 作者: JingLuo05 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def POST(self):
        form = formA()
        self.new_question = question
        if not form.validates():
            return render.add(question, form)
        else:
            new_answer = form['Answer'].value
            web.header('Content-Type','text/html; charset=utf-8', unique=True)
            print self.new_question
            global after_question
            robot.addAnswer(after_question, new_answer)
            raise web.seeother('/')
server.py 文件源码 项目:CloudPrint 作者: William-An 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def POST(self):
        x = web.input(myfile={})
        filedir = '.\\File'                                  # change this to the directory you want to store the file in.
        if 'myfile' in x:                                   # to check if the file-object is created
            filepath=x.myfile.filename.replace('\\','/')    # replaces the windows-style slashes with linux ones.
            filename=filepath.split('\\')[-1]               # splits the and chooses the last part (the filename with extension)
            fout = open(filedir +'\\'+ filename,'wb')       # creates the file where the uploaded file should be stored
            fout.write(x.myfile.file.read())                # writes the uploaded file to the newly created file.
            fout.close()                                    # closes the file, upload complete.
        filename = filedir+"\\"+filename
        if 'doc' or 'pdf' in filename[-4:]:                
            printer(filename)
        # else if 'pdf'in filename[-4:]: TODO finish pdf printing
        #     doc_print(filename,printer='arco')
        raise web.seeother('/upload')
main.py 文件源码 项目:smartthings-monitor 作者: CNG 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def POST(self):
        log.debug('register.POST')
        params   = web.input()
        username = params["username"]
        password = params["password"]
        user     = users.register(
            username=username,
            password=users.pswd(password, username),
            )
        users.login(user)
        log.debug('user is {0}'.format(user))
        raise web.seeother('/')
main.py 文件源码 项目:smartthings-monitor 作者: CNG 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def POST(self):
        log.debug('login.POST')
        params = web.input()
        user   = users.authenticate(
            params["username"],
            params["password"],
            )
        if user:
            log.debug('user is {0}'.format(user))
            users.login(user)
            raise web.seeother('/')
        else:
            log.error('login failed, so user not set')
            raise web.seeother('/error')
main.py 文件源码 项目:smartthings-monitor 作者: CNG 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def GET(self):
        log.debug('logout.GET')
        users.logout() #  runs session.kill()
        raise web.seeother('/')
main.py 文件源码 项目:smartthings-monitor 作者: CNG 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def GET(self, shortcode):
        log.debug('data.GET')
        user = users.collection.find_one({SHORT_KEY: shortcode})
        if user:
            log.debug('shortcode {0} matches user {1}'.format(shortcode, user))
        else:
            log.debug('no user found matching shortcode')
            raise web.seeother('/error')
        return render.data(processor.results(user["token"]))
untwisted.py 文件源码 项目:py-script 作者: xiaoxiamin 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def POST(self):
            mfeed.publish('<p>%s</p>' % web.input().text + (" " * 2048))
            web.seeother('/')
application.py 文件源码 项目:py-script 作者: xiaoxiamin 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_redirect(self):
        urls = (
            "/(.*)", "blog"
        )
        class blog:
            def GET(self, path):
                if path == 'foo':
                    raise web.seeother('/login', absolute=True)
                else:
                    raise web.seeother('/bar')
        app_blog = web.application(urls, locals())

        urls = (
            "/blog", app_blog,
            "/(.*)", "index"
        )
        class index:
            def GET(self, path):
                return "hello " + path
        app = web.application(urls, locals())

        response = app.request('/blog/foo')
        self.assertEquals(response.headers['Location'], 'http://0.0.0.0:8080/login')

        response = app.request('/blog/foo', env={'SCRIPT_NAME': '/x'})
        self.assertEquals(response.headers['Location'], 'http://0.0.0.0:8080/x/login')

        response = app.request('/blog/foo2')
        self.assertEquals(response.headers['Location'], 'http://0.0.0.0:8080/blog/bar')

        response = app.request('/blog/foo2', env={'SCRIPT_NAME': '/x'})
        self.assertEquals(response.headers['Location'], 'http://0.0.0.0:8080/x/blog/bar')
browser.py 文件源码 项目:py-script 作者: xiaoxiamin 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def GET(self):
        i = web.input(url='/')
        raise web.seeother(i.url)
app.py 文件源码 项目:lc_cloud 作者: refractionPOINT 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def redirectTo( page, **kwargs ):
    dest = '/%s?%s' % ( page, urllib.urlencode( kwargs ) )
    raise web.seeother( dest )
untwisted.py 文件源码 项目:lantern-detection 作者: gongxijun 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def POST(self):
            mfeed.publish('<p>%s</p>' % web.input().text + (" " * 2048))
            web.seeother('/')
app_backup.py 文件源码 项目:MonopolyWeb 作者: zeal4u 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def POST(self):
        form = web.input(player_name="Nobody")
        # need
        session.player_names = []

        for name in form.player_name.split(','):
            session.player_names.append(name)
        raise web.seeother('/game')
cosa_nostra.py 文件源码 项目:cosa-nostra 作者: joxeankoret 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def POST(self):
    i = web.input(username="", password="")
    if i.username == "" or i.password == "":
      return render.error("Invalid username or password")
    elif i.username != CN_USER or sha1(i.password).hexdigest() != CN_PASS:
      return render.error("Invalid username or password")
    session.user = i.username
    return web.seeother("/")

#-----------------------------------------------------------------------


问题


面经


文章

微信
公众号

扫码关注公众号