Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#20933 closed Bug (fixed)

manage.py loaddata stopped working on Django 1.6b2

Reported by: static Owned by: aaugustin
Component: Database layer (models, ORM) Version: 1.6-beta-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by apollo13)

Hello,

I have a script for loading fixtures that always worked in Django and it suddenly stopped working on Django 1.6b2. It works on 1.5.1, 1.5.2 and 1.6b1.

### Create an app called appname and a folder called fixtures with a file groups.yaml like this:

- fields:
    name: Group1
    permissions: []
  model: auth.group
  pk: 1
- fields:
    name: Group2
    permissions: []
  model: auth.group
  pk: 2
- fields:
    name: Group3
    permissions: []
  model: auth.group
  pk: 3

### Try run on terminal
python manage.py loaddata appname/fixtures/groups.yaml

### Output for Django 1.6b2
.../local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py:218: UserWarning: No fixture named 'appname/fixtures/groups' found.

warnings.warn("No fixture named '%s' found." % fixture_name)

Installed 0 object(s) from 0 fixture(s)

(test was made using PostgreSQL with psycopg2 2.5.1 - I didn't had time to test on other dbs)

Change History (11)

comment:1 Changed 23 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

The major refactoring in 51aa000378c00a442273f01142acdebc94dec68d may have broken loading fixtures from an absolute path, but it was before 1.6b1. Are you positive it still works in 1.6b1?

It would be extremely helpful if you could bisect to find the commit that introduced the regression.

comment:2 Changed 23 months ago by static

I am sorry! I just noticed this error now (testing in 1.6). I am sure it works on 1.5.1 and 1.5.2 not in 1.6b1. I will make the test again in beta 1.

Last edited 23 months ago by static (previous) (diff)

comment:3 follow-up: Changed 23 months ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

Right. I must have broken loading fixtures from an absolute path — the third option mentioned here: https://docs.djangoproject.com/en/dev/howto/initial-data/#where-django-finds-fixture-files

comment:4 Changed 23 months ago by static

Testing done, it doesn't work in 1.6b1 either. I am sorry again.

comment:5 Changed 23 months ago by static

  • Version changed from master to 1.6-beta-1

comment:6 Changed 23 months ago by apollo13

  • Description modified (diff)

comment:7 in reply to: ↑ 3 Changed 23 months ago by apollo13

Replying to aaugustin:

Right. I must have broken loading fixtures from an absolute path — the third option mentioned here: https://docs.djangoproject.com/en/dev/howto/initial-data/#where-django-finds-fixture-files

No, absolute paths work as intended:

./manage.py loaddata `pwd`/appname/fixtures/groups
Installed 3 object(s) from 1 fixture(s)

The issue is relative paths, which aren't documented to work, though it would make sense that they do, I'll see what I can do.

comment:8 Changed 23 months ago by apollo13

https://github.com/django/django/pull/1492 Pull request with "not so strict" validation of the path.

comment:9 Changed 23 months ago by Florian Apolloner <florian@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 96346ed5adf90849ac5ebd10d74377ed2e0c061c:

Fixed #20933 -- Allowed loaddata to load fixtures from relative paths.

comment:10 Changed 23 months ago by Florian Apolloner <florian@…>

In 12d364a9b0b4bf820a68104a64ba312c7290518b:

[1.6.x] Fixed #20933 -- Allowed loaddata to load fixtures from relative paths.

Backport of 6e846f7627ecf0dc15053624a23bfbf47535972d from master.

comment:11 Changed 23 months ago by Andrew Godwin <andrew@…>

In 839940f27f25c2dafaa5b2ec934c2dd6b80903e8:

Fixed #20933 -- Allowed loaddata to load fixtures from relative paths.

Note: See TracTickets for help on using tickets.
Back to Top