Typo found, too many indents. Apologies.
On Feb 16, 8:04 am, Jonathan Lukens <[EMAIL PROTECTED]> wrote:
> Unless I am missing something, I have to work around using
> newforms.FileField because I need to do some specific validation on
> the file on upload, and FileField returns UploadedFile, which is not
> really a file anymore but the guts of the file and its name. So, I
> have the following form/field validation rules in
> forms.py:http://dpaste.com/35466/
> When I actually try to upload the file, I get "TypeError at /tools/
> translit-plus/complete/: 'NoneType' object is unsubscriptable" on
> ``sourcetext = unicode(form.cleaned_data['sourcetext']['content'],
> 'utf-8')`` (line 36 in the dpaste link).
> What baffles me about this is that the validation rule that does
> essentially the same thing in line 19 works -- meaning that if I
> upload a .txt file with ANSI encoding, I get the validation error
> message from line 23. Why is .cleaned_data['sourcetext']
> subscriptable there and not in views.py?
> It was actually working fine in views.py for a couple hours and while
> doing something unrelated it started producing that errror message.
> This makes me think "typo", but I have stared at it for so many hours
> that I am starting to go cross-eyed.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---