web.input.has_key

Here are the examples of the python api web.input.has_key taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: googlemodules Source File: base.py
    def GET(self):
        if web.input().has_key('q'):
           return web.seeother('/search/?' + utils.url_encode(web.input()))
            
        latest_modules, has_next = modules.get_latest()
        return render.layout(
            view.list_modules(latest_modules, next_page_url='/page/1/', sub_title='Latest Modules'))

Example 2

Project: karesansui Source File: rest.py
Function: post
    def POST(self, *param, **params):
        """<comment-ja>
        Method POSTの処理を行います。
          - オーバーロードPOSTに対応しています。
            - リクエストの中に _method を設定することで動作します。(POST,PUT,DELETE)
            - 例) <input type='hidden' name='_method' value='POST' />
          - 各処理は継承先で _POST メソッドを作成し、そこに記述してください。
        </comment-ja>
        <comment-en>
        TODO: English Comment
        </comment-en>
        """
        try:
            if web.input(_unicode=False).has_key(OVERLOAD_METHOD):
                self.__method__ = web.input(_unicode=False)[OVERLOAD_METHOD].upper()
                if self.__method__ == PUT:
                    self.__method__ = PUT
                    self.logger.debug("OVERLOAD - POST -> PUT")
                    return self.__method_call(*param, **params)
                elif self.__method__ == DELETE:
                    self.__method__ = DELETE
                    self.logger.debug("OVERLOAD - POST -> DELETE")
                    return self.__method_call(*param, **params)
                elif self.__method__ == GET:
                    self.__method__ = GET
                    self.logger.debug("OVERLOAD - POST -> GET")
                    return self.__method_call(*param, **params)

            # POST Method
            self.__method__ = POST    
            self._pre(*param, **params)
            _r = self.__method_call(prefix='_', *param, **params)
            return self._post(_r)
        except web.HTTPError, e:
            raise
        except:
            self.logger_trace.error(traceback.format_exc())
            #return web.internalerror()
            raise