I was looking at someone else's code and saw the following code: try: object.photo._require_file() except ValueError: #handle exception
Where object is a model instance and photo is an ImageField attribute. Can someone tell me what _require_file() does? Here is the definition of it in django/db/models/fields/files.py class FieldFile(File): def _require_file(self): if not self: raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) But I just don't know what this does or is suppose to. The way I read it, if self is None, raise ValueError() which calls self.field.name which would be invalid since self is None. Also, since calling this method is done through a FieldFile object (or ImageFieldFile in this case), it can't be None. I am sure I am missing some strange tricky bit of Python classes and objects, but I can't find anything on this. Thanks, John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---