[Django] #23468: fixtures are imported twice with duplicate FIXTURE_DIRS

264 views
Skip to first unread message

Django

unread,
Sep 11, 2014, 7:20:29 AM9/11/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------+--------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
when listing a fixture dir two times in FIXTURE_DIRS, or listing a
directory there that is already a default fixture dir of an app, fixtures
in these directories are imported twice when running loaddata.

in my project someone accidentally added a default fixture dir to the
FIXTURE_DIRS, and it took us a while to figure out why things were
imported twice.

on a side node, if fixtures of the same name are in different directories,
there are all imported, as opposed to when they are in the same directory
(with different extensions). is this intended?

--
Ticket URL: <https://code.djangoproject.com/ticket/23468>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 28, 2014, 9:14:21 AM9/28/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------

Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_docs: => 0
* needs_better_patch: => 0
* component: Uncategorized => Core (Management commands)
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

In this situation, Django could raise an `ImproperlyConfigured` exception,
emit a warning (maybe with a check?), or at least deduplicate the list.
Loading the fixture twice doesn't make sense.


Regarding your second question, yes, this is the intended behavior.

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:1>

Django

unread,
Oct 10, 2014, 3:47:14 AM10/10/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned

Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* status: new => assigned
* owner: nobody => kswiat


--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:2>

Django

unread,
Oct 10, 2014, 12:52:25 PM10/10/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1


Comment:

Work in progress:
https://github.com/kswiat/django/commit/0b96027f697c173f860be2cef18451a715dbe7f1

But I will probably move it to the check framework, because apps are not
ready at this point (loading settings). Apps need to be registered in
order to get their labels (correct me if I'm wrong and there is other
clean way to do it).

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:3>

Django

unread,
Oct 10, 2014, 3:01:47 PM10/10/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 0

Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:4>

Django

unread,
Oct 11, 2014, 3:17:27 PM10/11/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0

Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


Comment:

Pull request ready.

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:5>

Django

unread,
Oct 18, 2014, 12:26:44 PM10/18/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by claudep):

Wouldn't it be better to check this in the loaddata `fixture_dirs` method?

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:6>

Django

unread,
Oct 30, 2014, 1:31:05 PM10/30/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:7>

Django

unread,
Oct 30, 2014, 3:10:16 PM10/30/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* cc: konrad.swiat@… (added)


Comment:

There is new PR with different approach, that checks settings.FIXTURE_DIRS
in the loaddata fixture_dirs method. If there are duplications or default
fixture dir of an app, exception is raised.
https://github.com/django/django/pull/3447
Or maybe it should emit a warning instead of raising?

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:8>

Django

unread,
Oct 30, 2014, 3:48:11 PM10/30/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:9>

Django

unread,
Oct 31, 2014, 6:31:12 AM10/31/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 1

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by berkerpeksag):

* needs_better_patch: 0 => 1

* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:10>

Django

unread,
Oct 31, 2014, 7:08:19 AM10/31/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kswiat):

* needs_better_patch: 1 => 0

* needs_docs: 1 => 0


Comment:

I added release notes for 1.7.2, 1.8 and improved patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:11>

Django

unread,
Oct 31, 2014, 6:24:45 PM10/31/14
to django-...@googlegroups.com
#23468: fixtures are imported twice with duplicate FIXTURE_DIRS
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kswiat
Type: Bug | Status: closed

Component: Core (Management | Version: 1.6
commands) | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"934a16dc93a5f46f965ba299dbd543703d32d493"]:
{{{
#!CommitTicketReference repository=""
revision="934a16dc93a5f46f965ba299dbd543703d32d493"
Fixed #23468 -- Added checks for duplicate fixtures directories in
loaddata.

If settings.FIXTURE_DIRS contains duplicates or a default fixture
directory (app_name/fixtures), ImproperlyConfigured is raised.

Thanks to Berker Peksag and Tim Graham for review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:12>

Reply all
Reply to author
Forward
0 new messages