django-imagekit
django-imagekit copied to clipboard
source_name_dot_hash could yield `AttributeError` because of unhandled None
Only noticed this while mocking out branch coverage for a custom namer (which essentially copies most of source_name_dot_hash):
if source_filename becomes None because for whatever reason generator.source does not have a name attribute, then attempting to get the basename will fail because AttributeError: 'NoneType' object has no attribute 'rfind' deep inside os.path.basename()
As an aside, it was a touch difficult to figure out was going on because doing dir(generator) inside a debugging session didn't work, because the builtin dir() is clobbered by the dir = assignment.