'Updates a collection in-place.
The exact behavior of ``PATCH`` to a list resource is still the matter of
some debate in REST circles, and the ``PATCH`` RFC isn\'t standard. So the
behavior this method implements (described below) is something of a
stab in the dark. It\'s mostly cribbed from GData, with a smattering
of ActiveResource-isms and maybe even an original idea or two.
The ``PATCH`` format is one that\'s similar to the response returned from
a ``GET`` on a list resource::
"objects": [{object}, {object}, ...],
"deleted_objects": ["URI", "URI", "URI", ...],
For each object in ``objects``:
* If the dict does not have a ``resource_uri`` key then the item is
considered "new" and is handled like a ``POST`` to the resource list.
* If the dict has a ``resource_uri`` key and the ``resource_uri`` refers
to an existing resource then the item is a update; it\'s treated
like a ``PATCH`` to the corresponding resource detail.
* If the dict has a ``resource_uri`` but the resource *doesn\'t* exist,
then this is considered to be a create-via-``PUT``.
Each entry in ``deleted_objects`` referes to a resource URI of an existing
resource to be deleted; each is handled like a ``DELETE`` to the relevent
resource.
In any case:
* If there\'s a resource URI it *must* refer to a resource of this
type. It\'s an error to include a URI of a different resource.
* ``PATCH`` is all or nothing. If a single sub-operation fails, the
entire request will fail and all resources will be rolled back.
* For ``PATCH`` to work, you **must** have ``put`` in your
:ref:`detail-allowed-methods` setting.
* To delete objects via ``deleted_objects`` in a ``PATCH`` request you
**must** have ``delete`` in your :ref:`detail-allowed-methods`
setting.
Substitute appropriate names for ``objects`` and
``deleted_objects`` if ``Meta.collection_name`` is set to something
other than ``objects`` (default).'

def patch_list(self, request, **kwargs):

    request = convert_post_to_patch(request)
    deserialized = self.deserialize(request, request.body, format=request.META.get(u'CONTENT_TYPE', u'application/json'))
    collection_name = self._meta.collection_name
    deleted_collection_name = (u'deleted_%s' % collection_name)
    if (collection_name not in deserialized):
        raise BadRequest((u"Invalid    data    sent:    missing    '%s'" % collection_name))
    if (len(deserialized[collection_name]) and (u'put' not in self._meta.detail_allowed_methods)):
        raise ImmediateHttpResponse(response=http.HttpMethodNotAllowed())
    bundles_seen = []
    for data in deserialized[collection_name]:
        if (u'resource_uri' in data):
            uri = data.pop(u'resource_uri')
            try:
                obj = self.get_via_uri(uri, request=request)
                bundle = self.build_bundle(obj=obj, request=request)
                bundle = self.full_dehydrate(bundle, for_list=True)
                bundle = self.alter_detail_data_to_serialize(request, bundle)
                self.update_in_place(request, bundle, data)
            except (ObjectDoesNotExist, MultipleObjectsReturned):
                data = self.alter_deserialized_detail_data(request, data)
                bundle = self.build_bundle(data=dict_strip_unicode_keys(data), request=request)
                self.obj_create(bundle=bundle)
        else:
            data = self.alter_deserialized_detail_data(request, data)
            bundle = self.build_bundle(data=dict_strip_unicode_keys(data), request=request)
            self.obj_create(bundle=bundle)
        bundles_seen.append(bundle)
    deleted_collection = deserialized.get(deleted_collection_name, [])
    if deleted_collection:
        if (u'delete' not in self._meta.detail_allowed_methods):
            raise ImmediateHttpResponse(response=http.HttpMethodNotAllowed())
        for uri in deleted_collection:
            obj = self.get_via_uri(uri, request=request)
            bundle = self.build_bundle(obj=obj, request=request)
            self.obj_delete(bundle=bundle)
    if (not self._meta.always_return_data):
        return http.HttpAccepted()
    else:
        to_be_serialized = {u'objects': [self.full_dehydrate(b, for_list=True) for b in bundles_seen]}
        to_be_serialized = self.alter_list_data_to_serialize(request, to_be_serialized)
        return self.create_response(request, to_be_serialized, response_class=http.HttpAccepted)
