'Looks up whether a static file is readable by the application.
Uses the handlers in \'config\' to determine if the file should
be treated as a static file and if so, if the file should be readable by the
application.
Args:
config: The AppInfoExternal object to check the filename against.
filename: The name of the file.
Returns:
True if the file is static and marked as app readable, False otherwise.'

@staticmethod
def __GetAppReadableIfStaticFile(config, filename):

    for handler in config.handlers:
        handler_type = handler.GetHandlerType()
        if (handler_type in ('static_dir', 'static_files')):
            if (handler_type == 'static_dir'):
                regex = os.path.join(re.escape(handler.GetHandler()), '.*')
            else:
                regex = handler.upload
            if re.match(regex, filename):
                return handler.application_readable
    return False
