(form, properties)
return form_info
This is a helper function for build_form_multimedia_zip.
    Return a dict containing information about the given form and its relevant
    attachments
This is a helper function for build_form_multimedia_zip.
    Return a dict containing information about the given form and its relevant
    attachments
This is a helper function for build_form_multimedia_zip . Return a dict containing information about the given form and its relevant attachments
def _extract_form_attachment_info(form, properties):
    """
    This is a helper function for build_form_multimedia_zip.
    Return a dict containing information about the given form and its relevant
    attachments
    """

    unknown_number = 0

    case_blocks = extract_case_blocks(form.form_data)
    form_info = {
        'form': form,
        'attachments': [],
        'case_ids': {c['@case_id'] for c in case_blocks},
        'username': form.get_data('form/meta/username')
    }

    for attachment_name, attachment in form.attachments.items():
        content_type = attachment.content_type
        if content_type == 'text/xml':
            continue

        question_id = _get_question_id_for_attachment(form.form_data, attachment_name)
        if question_id is None:
            question_id = 'unknown' + str(unknown_number)
            unknown_number += 1

        if not properties or question_id in properties:
            extension = str(os.path.splitext(attachment_name)[1])
            form_info['attachments'].append({
                'size': attachment.content_length,
                'name': attachment_name,
                'question_id': question_id,
                'extension': extension,
                'timestamp': form.received_on.timetuple(),
            })

    return form_info
def _extract_form_attachment_info ( form , properties ) : unknown_number = 0 case_blocks = extract_case_blocks ( form . form_data ) form_info = { 'form' : form , 'attachments' : [ ] , 'case_ids' : { c [ '@case_id' ] for c in case_blocks } , 'username' : form . get_data ( 'form/meta/username' ) } for attachment_name , attachment in form . attachments . items ( ) : content_type = attachment . content_type if content_type == 'text/xml' : continue question_id = _get_question_id_for_attachment ( form . form_data , attachment_name ) if question_id is None : question_id = 'unknown' + str ( unknown_number ) unknown_number += 1 if not properties or question_id in properties : extension = str ( os . path . splitext ( attachment_name ) [ 1 ] ) form_info [ 'attachments' ] . append ( { 'size' : attachment . content_length , 'name' : attachment_name , 'question_id' : question_id , 'extension' : extension , 'timestamp' : form . received_on . timetuple ( ) , } ) return form_info