Running Django v1.0.2. I have a form with a file field. The file needs to be in PDF format, so I have a clean routine that checks that (modified slightly to NOT wrap lines):
def clean_PDF_File(self): """Verify that the content is PDF format""" type = "application/pdf" if self.cleaned_data["PDF_File"].content_type != type: raise forms.ValidationError("File must be in PDF format") return self.cleaned_data["PDF_File"] A simplified view looks like this: if form.is_valid(): <do valid stuff> else: print "Errors = [", form.errors, "]" I'm expecting form.errors to contain the message I gave to ValidationError(). Instead, this is what prints out: Errors = [ <ul class="errorlist"><li>PDF_File<ul class="errorlist"><li>The submitted file is empty.</li></ul></li></ul> ] What happened to my error message? I can't pass the correct error message to the form if I don't receive it in the first place. When the field is blank, I get the correct error message that I expect to see: Errors = [ <ul class="errorlist"><li>PDF_File<ul class="errorlist"><li>This field is required.</li></ul></li></ul> ] Any thoughts on what else I might try or look at? -- Adam Stein @ Xerox Corporation Email: a...@eng.mc.xerox.com Disclaimer: Any/All views expressed here have been proven to be my own. [http://www.csh.rit.edu/~adam/] --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---