Did I find the right examples for you? yes no

All Samples(5)  |  Call(5)  |  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/middleware/misc.py   whiff(Download)
            yield x
        elif tx is UnicodeType:
            yield stream.mystr(x)
            yield str(x)
        return None
    if type(thing) in types.StringTypes:
        return stream.mystr(thing)
    else: # elif isinstance(thing, stream.StreamApp):
        # try to interpret it as a WSGI app

src/w/h/whiff-1.1/whiff/resources/PageShadow.py   whiff(Download)
    def put(self, pathlist, value):
        assert len(pathlist)==0, "no parameters expected"
        filepath = self.shadowPath()
        f = file(filepath, "w")

src/w/h/whiff-1.1/whiff/middleware/base64DataUrl.py   whiff(Download)
    def __call__(self, env, start_response):
        # allow the page to start the response
        page = self.param_binary(self.page, env)
        page = stream.mystr(page)
        b64data = base64.b64encode(page)

src/w/h/whiff-1.1/whiff/middleware/addCommentsFromResource.py   whiff(Download)
    def getData(self, resourcePath, env):
        getter = getResource.getResource(resourcePath)
        text = stream.mystr(self.param_value(getter, env).strip())
        if not text:
            text = "[]"