

def determine_file_type(self, name):
    "\n        >>> t = MediaFileBase()\n        >>> str(t.determine_file_type('foobar.jpg'))\n        'image'\n        >>> str(t.determine_file_type('foobar.PDF'))\n        'pdf'\n        >>> str(t.determine_file_type('foobar.jpg.pdf'))\n        'pdf'\n        >>> str(t.determine_file_type('foobar.jgp'))\n        'other'\n        >>> str(t.determine_file_type('foobar-jpg'))\n        'other'\n        "
    for (type_key, type_name, type_test) in self.filetypes:
        if type_test(name):
            return type_key
    return self.filetypes[(- 1)][0]

dataset/ETHPy150Open feincms/feincms/feincms/module/medialibrary/models.py MediaFileBase.determine_file_type/original