'Performs a ton of checks to make sure the user\'s input is valid, raising
BaseFrameworkException if something fails.
:param value: User input, which might look like:
* /home/foo/file
* %ROOT_PATH%/foo/file
* base64://...
:return: The decoded value to show to the user'

def validate(self, value):

    if self.is_base64_data(value):
        try:
            return self.create_tempfile(value)
        except zlib.error:
            msg = 'The    self    contained    file    raised    a    zlib    decoding    error'
            raise BaseFrameworkException(msg)
        except TypeError:
            msg = 'The    self    contained    file    raised    a    base64    decode    error'
            raise BaseFrameworkException(msg)
    value = value.replace(ROOT_PATH_VAR, ROOT_PATH)
    directory = os.path.abspath(os.path.dirname(value))
    if (not os.path.isdir(directory)):
        msg = 'Invalid    input    file    option    value    "%s",    the    directory    does    not    exist.'
        raise BaseFrameworkException((msg % value))
    if (not os.access(directory, os.R_OK)):
        msg = 'Invalid    input    file    option    value    "%s",    the    user    does    not    have    enough    permissions    to    read    from    the    specified    directory.'
        raise BaseFrameworkException((msg % value))
    if (not os.path.exists(value)):
        msg = 'Invalid    input    file    option    value    "%s",    the    specified    file    does    not    exist.'
        raise BaseFrameworkException((msg % value))
    if (not os.access(value, os.R_OK)):
        msg = 'Invalid    input    file    option    value    "%s",    the    user    does    not    have    enough    permissions    to    read    the    specified    file.'
        raise BaseFrameworkException((msg % value))
    if (not os.path.isfile(value)):
        msg = 'Invalid    input    file    option    value    "%s",    the    path    does    not    point    to    a    file.'
        raise BaseFrameworkException((msg % value))
    return value
