(self, key)
return r
>>> from io import BytesIO
        >>> b = '----WebKitFormBoundaryQQ3J8kPsjFpTmqNz'
        >>> pl = ['--%s' % b, 'Content-Disposition: form-data; name=\"name\"\n', 'Scofield', '--%s' % b, 'Content-Disposition: form-data; name=\"name\"\n','Lincoln', '--%s' % b, 'Content-Disposition: form-data; name=\"file\"; filename=\"test.txt\"', 'Content-Type: text/plain\n', 'just a test','--%s' % b, 'Content-Disposition: form-data; name=\"id\"\n', '4008009001', '--%s--' % b, '']
        >>> payload = '\n'.join(pl)
        >>> r = {'REQUEST_METHOD':'POST', 'CONTENT_LENGTH':str(len(payload)), 'CONTENT_TYPE':'multipart/form-data; boundary=%s' %b, 'wsgi.input':BytesIO(payload.encode())}
        >>> r.get('name')
        'Scofield'
        >>> r.gets('name')
        ['Scofield', 'Lincoln']
        >>> f = r.get('file')
        >>> f.filename
        'test.txt'
        >>> f.file.read()
        'just a test'
        :param key:
        :return:
>>> from io import BytesIO
        >>> b = '----WebKitFormBoundaryQQ3J8kPsjFpTmqNz'
        >>> pl = ['--%s' % b, 'Content-Disposition: form-data; name=\"name\"\n', 'Scofield', '--%s' % b, 'Content-Disposition: form-data; name=\"name\"\n','Lincoln', '--%s' % b, 'Content-Disposition: form-data; name=\"file\"; filename=\"test.txt\"', 'Content-Type: text/plain\n', 'just a test','--%s' % b, 'Content-Disposition: form-data; name=\"id\"\n', '4008009001', '--%s--' % b, '']
        >>> payload = '\n'.join(pl)
        >>> r = {'REQUEST_METHOD':'POST', 'CONTENT_LENGTH':str(len(payload)), 'CONTENT_TYPE':'multipart/form-data; boundary=%s' %b, 'wsgi.input':BytesIO(payload.encode())}
        >>> r.get('name')
        'Scofield'
        >>> r.gets('name')
        ['Scofield', 'Lincoln']
        >>> f = r.get('file')
        >>> f.filename
        'test.txt'
        >>> f.file.read()
        'just a test'
        :param key:
        :return:
>>> from io import BytesIO >>> b = ---- WebKitFormBoundaryQQ3J8kPsjFpTmqNz >>> pl = [ -- %s % b Content - Disposition : form - data ; name = \ name \ \ n Scofield -- %s % b Content - Disposition : form - data ; name = \ name \ \ n Lincoln -- %s % b Content - Disposition : form - data ; name = \ file \ ; filename = \ test . txt \ Content - Type : text / plain \ n just a test -- %s % b Content - Disposition : form - data ; name = \ id \ \ n 4008009001 -- %s -- % b ] >>> payload = \ n . join ( pl ) >>> r = { REQUEST_METHOD : POST CONTENT_LENGTH : str ( len ( payload )) CONTENT_TYPE : multipart / form - data ; boundary = %s %b wsgi . input : BytesIO ( payload . encode () ) } >>> r . get ( name ) Scofield >>> r . gets ( name ) [ Scofield Lincoln ] >>> f = r . get ( file ) >>> f . filename test . txt >>> f . file . read () just a test : param key : : return :
def __getitem__(self, key):
        """
        >>> from io import BytesIO
        >>> b = '----WebKitFormBoundaryQQ3J8kPsjFpTmqNz'
        >>> pl = ['--%s' % b, 'Content-Disposition: form-data; name=\"name\"\n', 'Scofield', '--%s' % b, 'Content-Disposition: form-data; name=\"name\"\n','Lincoln', '--%s' % b, 'Content-Disposition: form-data; name=\"file\"; filename=\"test.txt\"', 'Content-Type: text/plain\n', 'just a test','--%s' % b, 'Content-Disposition: form-data; name=\"id\"\n', '4008009001', '--%s--' % b, '']
        >>> payload = '\n'.join(pl)
        >>> r = {'REQUEST_METHOD':'POST', 'CONTENT_LENGTH':str(len(payload)), 'CONTENT_TYPE':'multipart/form-data; boundary=%s' %b, 'wsgi.input':BytesIO(payload.encode())}
        >>> r.get('name')
        'Scofield'
        >>> r.gets('name')
        ['Scofield', 'Lincoln']
        >>> f = r.get('file')
        >>> f.filename
        'test.txt'
        >>> f.file.read()
        'just a test'
        :param key:
        :return:
        """
        r = self._get_raw_input()[key]
        if isinstance(r, list):
            return r[0]
        return r
def __getitem__ ( self , key ) : r = self . _get_raw_input ( ) [ key ] if isinstance ( r , list ) : return r [ 0 ] return r