Adds a mapping between a file and a view class.
        Pattern can be an extension in the form .EXT or a filename.

def add_view_file_mapping(self, pattern, cls):
        """Adds a mapping between a file and a view class.
        Pattern can be an extension in the form .EXT or a filename.
        """
        if isinstance(pattern, str):
            if not pattern.endswith("*"):
                _, ext = os.path.splitext(pattern)
                self.allowed_extensions.add(ext)
            pattern = re.compile("^" + re.escape(pattern).replace("\\*", ".+") + "$", re.I)
        self.view_class_files_map.append((pattern, cls))