'Validates the request entered by the user'

def __validate_request(self, trans, cntrller, request):

    empty_fields = []
    for (index, field) in enumerate(request.type.request_form.fields):
        if ((field['required'] == 'required') and (request.values.content[field['name']] in ['', None])):
            empty_fields.append(field['label'])
    empty_sample_fields = []
    for s in request.samples:
        for field in request.type.sample_form.fields:
            log.debug('field:    %s', field)
            log.debug('svc:    %s', s.values.content)
            if ((field['required'] == 'required') and (s.values.content[field['name']] in ['', None])):
                empty_sample_fields.append((s.name, field['label']))
    if (empty_fields or empty_sample_fields):
        message = 'Complete    the    following    fields    of    the    request    before    submitting:    <br/>'
        if empty_fields:
            for ef in empty_fields:
                message += ('<b>%s</b><br/>' % ef)
        if empty_sample_fields:
            for (sname, ef) in empty_sample_fields:
                message = (message + ('<b>%s</b>    field    of    sample    <b>%s</b><br/>' % (ef, sname)))
        return message
    return None
