def update_items(portal_type=None, uid=None, endpoint=None, **kw):
<EOL>req.disable_csrf_protection()<EOL>records = req.get_request_data()<EOL>obj = get_object_by_uid(uid)<EOL>if obj:<EOL><INDENT>record = records[<NUM_LIT:0>]  <EOL>obj = update_object_with_data(obj, record)<EOL>return make_items_for([obj], endpoint=endpoint)<EOL><DEDENT>results = []<EOL>for record in records:<EOL><INDENT>obj = get_object_by_record(record)<EOL>if obj is None:<EOL><INDENT>continue<EOL><DEDENT>obj = update_object_with_data(obj, record)<EOL>results.append(obj)<EOL><DEDENT>if not results:<EOL><INDENT>fail(<NUM_LIT>, "<STR_LIT>")<EOL><DEDENT>return make_items_for(results, endpoint=endpoint)<EOL>
update items

    1. If the uid is given, the user wants to update the object with the data
       given in request body
    2. If no uid is given, the user wants to update a bunch of objects.
       -> each record contains either an UID, path or parent_path + id