#13314: "FileField" validation does not account for "upload_to" when counting
characters
------------------------------------+---------------------------------------
          Reporter:  denilsonsa     |         Owner:  nobody
            Status:  new            |     Milestone:        
         Component:  Uncategorized  |       Version:  1.1   
        Resolution:                 |      Keywords:        
             Stage:  Accepted       |     Has_patch:  0     
        Needs_docs:  0              |   Needs_tests:  0     
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Changes (by lrekucki):

 * cc: lrekucki (added)

Comment:

 I just go bitten by this. I'm not sure about how to fix this properly.
 Checking it at forms.FileField works as long as you are using ModelForms.
 IMHO, the FileField itself should reject names that exceed max_length
 after being processed by upload_to.

 Maybe we should also pass max_length as an argument to upload_to, so the
 user could handle this (with hashing for example). Either way, a custom
 exception would be much better than leaving it to the DB layer which
 yields a DatabaseError (and it would show up on sqlite, so people can
 catch this earlier).

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13314#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to