Did I find the right examples for you? yes no

All Samples(16)  |  Call(16)  |  Derive(0)  |  Import(0)
standard cgi parameter processing for WHIFF components, return new environment with adjustments

        def process_cgi(env,
                parse_cgi=None, # parse any cgi parameters (default: check environment)
                parse_get=None, # parse cgi GET parameters (default: check environment)
                parse_post=None, # parse cgi POST parameters (default: check environment)
                cgi_prefix=None # cull by prefix (default: check environment)
                ):
    "standard cgi parameter processing for WHIFF components, return new environment with adjustments"
    #pr "PROCESSING CGI WITH ARGUMENT PREFIX", cgi_prefix
    envcopy = env.copy()
    if envcopy.has_key(whiffenv.CGI_DICTIONARY):
        envcopy[whiffenv.CGI_DICTIONARY] = envcopy[whiffenv.CGI_DICTIONARY].copy()
    # parse cgi parameters if not done already
    cgi_parsed_here = False
    if parse_cgi is None:
        parse_cgi = envcopy.get(whiffenv.PARSE_CGI, False)
    if parse_get is None:
        parse_get = envcopy.get(whiffenv.PARSE_CGI_GET, False)
    if parse_post is None:
        parse_post = envcopy.get(whiffenv.PARSE_CGI_POST, False)
    if not envcopy.has_key(whiffenv.CGI_DICTIONARY):
        #pr "parse cgi flags", (parse_cgi, parse_get, parse_post)
        # if parse_cgi is set then install the cgi resource (parse get, post, or multipart)
        if parse_cgi:
            import gateway
            # resource path for cgi dictionary
            resourcePath = ["cgi", None]
            # get the dictionary and quote it
            unquoted = gateway.getResource(env, resourcePath)
            quoted = {}
            for name in unquoted:
                quoted[name] = [ quote(x) for x in unquoted[name]]
            envcopy[whiffenv.CGI_DICTIONARY] = quoted #gateway.getResource(env, resourcePath)
        else:
            if parse_get:
                # parse only the get parameters
                parse_cgi_get(envcopy)
                cgi_parsed_here = True
            if parse_post:
                # parse only the post parameters using standard cgi encoding (not multipart)
                parse_cgi_post(envcopy)
                cgi_parsed_here = True
        #pr "dict is now", envcopy.get(whiffenv.CGI_DICTIONARY)
        # XXX ? remove the marks?
    else:
        # someone else has already parsed the cgi parameters... don't do it again (???)
        pass
    #pr "after cgi-parse check dict is", envcopy.get(whiffenv.CGI_DICTIONARY)
    # store the cgi_dictionary as the top cgi dictionary unless already set 
    if envcopy.get(whiffenv.TOP_CGI_DICTIONARY) is None:
        envcopy[whiffenv.TOP_CGI_DICTIONARY] =  envcopy.get(whiffenv.CGI_DICTIONARY)
    # if a cgi-prefix is specified then cull the cgi-parameters (removing the prefix) and update the full prefix.
    if cgi_prefix is None:
        cgi_prefix = envcopy.get(whiffenv.CGI_PREFIX, "")
    full_prefix = envcopy.get(whiffenv.FULL_CGI_PREFIX, "")
    if cgi_prefix or (full_prefix and cgi_parsed_here):
        #pr "PROCESSING CGI PREFIX", cgi_prefix
        # update or create the full prefix entry
        full_prefix = envcopy.get(whiffenv.FULL_CGI_PREFIX, "")
        new_full_prefix = full_prefix+cgi_prefix
        envcopy[whiffenv.FULL_CGI_PREFIX] = new_full_prefix
        # if the cgi dictionary was parsed here then cull using the full prefix
        if cgi_parsed_here:
            cgi_prefix = new_full_prefix
        #pr "AT", envcopy["SCRIPT_NAME"], "SET CGI_PREFIX", envcopy[whiffenv.FULL_CGI_PREFIX]
        cgi_dict = envcopy.get(whiffenv.CGI_DICTIONARY)
        # set prefix to empty...
        if envcopy.has_key(whiffenv.CGI_PREFIX):
            #pr "NOW DELETING CGI_PREFIX", envcopy[whiffenv.CGI_PREFIX]
            #del envcopy[whiffenv.CGI_PREFIX]
            envcopy[whiffenv.CGI_PREFIX] = ""
        if cgi_dict is not None:
            prefixlen = len(cgi_prefix)
            # keep only cgi parameters which match the prefix, with the prefix removed from the name
            new_cgi_dict = {}
            for (k,v) in cgi_dict.items():
                if len(k)>prefixlen and k.startswith(cgi_prefix):
                    newk = k[prefixlen:]
                    new_cgi_dict[newk] = v
            envcopy[whiffenv.CGI_DICTIONARY] = new_cgi_dict
            #pr "old cgi dict", cgi_dict
            #pr "new cgi dict", new_cgi_dict
        else:
            # XXXX is this really an error?
            #raise ValueError, "cgi prefix may only be specified after cgi parameters have been parsed: "+repr(cgi_prefix) # ???
            pass
    return envcopy
        


src/w/h/whiff-1.1/whiff/middleware/getPage.py   whiff(Download)
        if update_environment:
            env = update_environment(env)
        env = resolver.process_cgi(env, parse_get=True)
        cgi_dict = env[whiffenv.CGI_DICTIONARY]
        pages = cgi_dict.get("page")

src/w/h/whiff-1.1/whiff/middleware/urlToPage.py   whiff(Download)
    def __call__(self, env, start_response):
        env = resolver.process_cgi(env, parse_cgi=True)
        qcontent = whiffenv.cgiGet(env, "content")
        qjheaders = whiffenv.cgiGet(env, "headers")
        qstatus = whiffenv.cgiGet(env, "status")

src/w/h/whiff-1.1/whiff/middleware/png/pieChart.py   whiff(Download)
    def __call__(self, env, start_response):
        env = resolver.process_cgi(env, parse_cgi=True)
        cgi_parameters = env[whiffenv.CGI_DICTIONARY]
        labelsAndData = cgi_parameters["labelsAndData"][0]
        labelsAndData = resolver.unquote(labelsAndData)

src/w/h/whiff-1.1/whiff/middleware/png/barChart.py   whiff(Download)
    def __call__(self, env, start_response):
        #pr "calling BarChart"
        env = resolver.process_cgi(env, parse_cgi=True)
        cgi_parameters = env[whiffenv.CGI_DICTIONARY]
        labelsAndData = cgi_parameters["labelsAndData"][0]

src/w/h/whiff-1.1/whiff/middleware/IfJavascriptUrl.py   whiff(Download)
    def __call__(self, env, start_response):
        env = resolver.process_cgi(env, parse_cgi=True)
        url = self.param_value(self.url, env).strip()
        relative_url = env[whiffenv.TEMPLATE_PATH]
        javaScriptEnabled = whiffenv.cgiGet(env, "javaScriptEnabled", False)

src/w/h/whiff-1.1/whiff/middleware/debugDump.py   whiff(Download)
    def __call__(self, env, start_response):
        content_type = self.param_value(self.content_type, env)
        parse_cgi = self.param_json(self.parse_cgi, env)
        if parse_cgi:
            cgi = resolver.process_cgi(env, parse_cgi=True)

src/w/h/whiff-1.1/whiff/middleware/skimpy.py   whiff(Download)
        #pr "got captcha, timeout, secret", (captcha, timeout, secret)
        # parse both get and post parameters
        env = resolver.process_cgi(env, parse_cgi=True)
        cgi_parameters = env[whiffenv.CGI_DICTIONARY]
        #pr "parameters are", cgi_parameters

src/w/h/whiff-1.1/whiff/servers/fsCSI/fsCSIroot/getCompletionInfo2.py   whiff(Download)
    def __call__(self, env, start_response):
        env = resolver.process_cgi(env, parse_cgi=True)
        # permit resource access
        env[whiffenv.RPC_TAINTED] = False
        cgiDict = env[whiffenv.CGI_DICTIONARY]

src/w/h/whiff-1.1/whiff/servers/fsCSI/fsCSIroot/getCompletionInfo.py   whiff(Download)
    def __call__(self, env, start_response):
        env = resolver.process_cgi(env, parse_cgi=True)
        # permit resource access
        env[whiffenv.RPC_TAINTED] = False
        cgiDict = env[whiffenv.CGI_DICTIONARY]

src/w/h/whiff-1.1/whiff/servers/fsCSI/fsCSIroot/fieldSetup.py   whiff(Download)
    def __call__(self, env, start_response):
        env = resolver.process_cgi(env, parse_cgi=True)
        cgiDict = env[whiffenv.CGI_DICTIONARY]
        L = []
        for name in cgiDict:

  1 | 2  Next