'django.test.client.put() does the wrong thing, here. This does
better, based on post().'

def _put(self, path, data={}, content_type=MULTIPART_CONTENT, follow=False, **extra):

    if (content_type is MULTIPART_CONTENT):
        post_data = encode_multipart(BOUNDARY, data)
    else:
        match = CONTENT_TYPE_RE.match(content_type)
        if match:
            charset = match.group(1)
        else:
            charset = settings.DEFAULT_CHARSET
        post_data = smart_str(data, encoding=charset)
    parsed = urlparse(path)
    params = {'CONTENT_LENGTH': len(post_data), 'CONTENT_TYPE': content_type, 'PATH_INFO': self.client._get_path(parsed), 'QUERY_STRING': parsed[4], 'REQUEST_METHOD': 'PUT', 'wsgi.input': FakePayload(post_data)}
    params.update(extra)
    response = self.client.request(**params)
    if follow:
        response = self.client._handle_redirects(response, **extra)
    return response
