Also, due to a change in 2.2 around using scandir on the form field for
FilePathField, if the path doesn't exist, a FileNotFoundError is issued
(same would have happened before the scandir change), but now the
try/except logic on OSError (super class) has been removed, in the PR that
changed to scandir.
So, the docs are out of date (regardless of whichever value is more sane
as a default), and the change on scandir also removed the try/except.
Previously it was not an issue because there was a try/except, so we were
caught off guard.
--
Ticket URL: <https://code.djangoproject.com/ticket/30908>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* severity: Normal => Release blocker
* component: Uncategorized => Forms
* easy: 0 => 1
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
Thanks for this report, I agree that it's a regression in
a0ca4b5694f43c63ea13ba6908eff2bd53ee7ebb. We should restore catching
`OSError`. Documentation issue is not a regression so I sent a separate
[https://github.com/django/django/pull/11974 PR] with fix.
Reproduced at fc2b1cc926e34041953738e58fa6ad3053059b22.
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:1>
* Attachment "test-30908.diff" added.
Regression test.
* Attachment "test-30908.diff" added.
Regression test.
--
Comment (by GitHub <noreply@…>):
In [changeset:"daa9415f78279855808134e1f40766f6c5f4bdbc" daa9415f]:
{{{
#!CommitTicketReference repository=""
revision="daa9415f78279855808134e1f40766f6c5f4bdbc"
Refs #30908 -- Fixed the empty value of forms.FilePathField in docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:2>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"76964cce206a0d709d874ea8f36c12f9f1d500e6" 76964cc]:
{{{
#!CommitTicketReference repository=""
revision="76964cce206a0d709d874ea8f36c12f9f1d500e6"
[3.0.x] Refs #30908 -- Fixed the empty value of forms.FilePathField in
docs.
Backport of daa9415f78279855808134e1f40766f6c5f4bdbc from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:3>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"48df40262bb13ff923dcbafc2bc70af12fe9db47" 48df402]:
{{{
#!CommitTicketReference repository=""
revision="48df40262bb13ff923dcbafc2bc70af12fe9db47"
[2.2.x] Refs #30908 -- Fixed the empty value of forms.FilePathField in
docs.
Backport of daa9415f78279855808134e1f40766f6c5f4bdbc from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:4>
* status: new => assigned
* owner: nobody => Hasan Ramezani
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:5>
* status: assigned => closed
* resolution: => wontfix
* severity: Release blocker => Normal
Comment:
Sorry for the previous acceptance, but it is
[https://docs.djangoproject.com/en/2.2/ref/forms/fields/#django.forms.FilePathField.path
documented] from the very beginning that `"This directory must exist"`
(see 4457ba002d64d4a991b0561c5be69a8c61b2b828). We removed catching
`OSError` in Django 2.2, but it was untested and undocumented behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:6>
Comment (by Hasan Ramezani):
Would it be good to add a test case for `OSError`?
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:7>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"6c6d24a4feb632fc07d35c2ce23bb00f6ea9215c" 6c6d24a4]:
{{{
#!CommitTicketReference repository=""
revision="6c6d24a4feb632fc07d35c2ce23bb00f6ea9215c"
Refs #30908 -- Added test for nonexistent path in forms.FilePathField.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30908#comment:8>