#28325: ImageFile extesion validation fails with: AttributeError: 'list' object
has
no attribute 'name'
-------------------------------------+-------------------------------------
Reporter: Maximilian | Owner: nobody
Kindshofer |
Type: Bug | Status: new
Component: File | Version: 1.11
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Old description:
> I upgraded from 1.11 from 1.10 and I get following error
>
> AttributeError: 'list' object has no attribute 'name'
> File "django/core/handlers/exception.py", line 41, in inner
> response = get_response(request)
> File "django/core/handlers/base.py", line 249, in _legacy_get_response
> response = self._get_response(request)
> File "django/core/handlers/base.py", line 187, in _get_response
> response = self.process_exception_by_middleware(e, request)
> File "django/core/handlers/base.py", line 185, in _get_response
> response = wrapped_callback(request, *callback_args,
> **callback_kwargs)
> File "auftragsverwaltung/views.py", line 292, in bilddokumentation_form
> if formset.is_valid():
> File "django/forms/formsets.py", line 321, in is_valid
> self.errors
> File "django/forms/formsets.py", line 295, in errors
> self.full_clean()
> File "django/forms/formsets.py", line 348, in full_clean
> self._errors.append(form.errors)
> File "django/forms/forms.py", line 175, in errors
> self.full_clean()
> File "django/forms/forms.py", line 386, in full_clean
> self._post_clean()
> File "django/forms/models.py", line 396, in _post_clean
> self.instance.full_clean(exclude=exclude, validate_unique=False)
> File "django/db/models/base.py", line 1226, in full_clean
> self.clean_fields(exclude=exclude)
> File "django/db/models/base.py", line 1268, in clean_fields
> setattr(self, f.attname, f.clean(raw_value, self))
> File "django/db/models/fields/__init__.py", line 603, in clean
> self.run_validators(value)
> File "django/db/models/fields/__init__.py", line 555, in run_validators
> v(value)
> File "django/core/validators.py", line 476, in __call__
> extension = os.path.splitext(value.name)[1][1:].lower()
>
> self:
> <django.core.validators.FileExtensionValidator object at 0x7fee879c6828>
> value:
> [
> <InMemoryUploadedFile: 20170619_150207.jpg (image/jpeg)>
> ]
New description:
I upgraded from 1.11 from 1.10 and I get following error
{{{
AttributeError: 'list' object has no attribute 'name'
File "django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "auftragsverwaltung/views.py", line 292, in bilddokumentation_form
if formset.is_valid():
File "django/forms/formsets.py", line 321, in is_valid
self.errors
File "django/forms/formsets.py", line 295, in errors
self.full_clean()
File "django/forms/formsets.py", line 348, in full_clean
self._errors.append(form.errors)
File "django/forms/forms.py", line 175, in errors
self.full_clean()
File "django/forms/forms.py", line 386, in full_clean
self._post_clean()
File "django/forms/models.py", line 396, in _post_clean
self.instance.full_clean(exclude=exclude, validate_unique=False)
File "django/db/models/base.py", line 1226, in full_clean
self.clean_fields(exclude=exclude)
File "django/db/models/base.py", line 1268, in clean_fields
setattr(self, f.attname, f.clean(raw_value, self))
File "django/db/models/fields/__init__.py", line 603, in clean
self.run_validators(value)
File "django/db/models/fields/__init__.py", line 555, in run_validators
v(value)
File "django/core/validators.py", line 476, in __call__
extension = os.path.splitext(value.name)[1][1:].lower()
self:
<django.core.validators.FileExtensionValidator object at 0x7fee879c6828>
value:
[
<InMemoryUploadedFile: 20170619_150207.jpg (image/jpeg)>
]
}}}
--
Comment (by Tim Graham):
Could you please give steps to reproduce the problem?
--
Ticket URL: <https://code.djangoproject.com/ticket/28325#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/078.3de9f1e73f6b318c7b77a0dbdab48553%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.