Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)

        def mystr(x):
    if type(x) is types.UnicodeType:
        return x.encode('utf-8')
    return str(x)
        


src/w/h/whiff-1.1/whiff/normalizeWsgiApplication.py   whiff(Download)
    def __call__(self, status, headers):
        sr = self.inner_start_response
        # make sure the headers are bytes, not unicode
        headers = [ (stream.mystr(n), stream.mystr(v)) for (n,v) in headers ]
        status = stream.mystr(status)

src/w/h/whiff-1.1/whiff/textcomponent.py   whiff(Download)
        header_list = [ ("Content-Type", "text/plain") ] # XXXX ???
        theArg = self.text
        payload = stream.mystr(theArg)
        start_response(status, header_list)
        return [payload]

src/w/h/whiff-1.1/whiff/namecomponent.py   whiff(Download)
        else:
            # just make sure it's a string.
            payload = stream.mystr(theArg)
        start_response(status, header_list)
        return [payload]

src/w/h/whiff-1.1/whiff/tester.py   whiff(Download)
        D = {}
        D["TESTER_URL"] = tester_url
        D["WSGI_ENVIRONMENT"] = stream.mystr(rdjson.jsonParse.format(env))
        D["SCRIPT_NAME"] = repr(env.get("SCRIPT_NAME"))
        D["PATH_INFO"] = repr(env.get("PATH_INFO"))
        D["QUERY_STRING"] = repr(env.get("QUERY_STRING"))
        D["WSGI_INPUT"] = input
        D["APPLICATION_TO_TEST"] = application_text
        D["EXPECT_STATUS"] = status
        D["EXPECT_HEADERS"] = stream.mystr(rdjson.jsonParse.format(headers))
        D["EXPECT_STATUS"] = status
        D["EXPECT_HEADERS"] = stream.mystr(rdjson.jsonParse.format(headers))
        D["EXPECT_OUTPUT"] = stream.mystr(output)
        return PAGE_DUMP_FORMAT % D
    def __call__(self, env, start_response):