Repository: translate/pootle

Issue:
Traceback with migration pootle_fs.0002_convert_localfs
I hit this traceback when running the new migrations in my local DB, specifically `pootle_fs.0002_convert_localfs`:


```pytb
Running migrations:
  Applying pootle_fs.0002_convert_localfs...Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    execute_from_command_line()
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 189, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/home/leo/Escritorio/core_pootle/pootle/apps/pootle_fs/migrations/0002_convert_localfs.py", line 118, in convert_to_localfs
    filepath = store.file.path[len(proj_trans_path):]
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/models/fields/files.py", line 63, in _get_path
    self._require_file()
  File "/home/leo/.virtualenvs/ptl/local/lib/python2.7/site-packages/django/db/models/fields/files.py", line 46, in _require_file
    raise ValueError("The '%s' attribute has no file associated with it." % self.field.name)
ValueError: The 'file' attribute has no file associated with it.
```


Discussion:

Resolving patch:
diff --git a/pootle/apps/pootle_fs/migrations/0002_convert_localfs.py b/pootle/apps/pootle_fs/migrations/0002_convert_localfs.py
--- a/pootle/apps/pootle_fs/migrations/0002_convert_localfs.py
+++ b/pootle/apps/pootle_fs/migrations/0002_convert_localfs.py
@@ -107,7 +107,7 @@ def convert_to_localfs(apps, schema_editor):
     for project in Project.objects.exclude(treestyle="pootle_fs"):
         proj_trans_path = os.path.join(old_translation_path, project.code)
         proj_stores = Store.objects.filter(
-            translation_project__project=project)
+            translation_project__project=project).exclude(file="")
         _set_project_config(Config, project_ct, project)
         project.treestyle = "pootle_fs"
         project.save()
diff --git a/pootle/apps/pootle_store/migrations/0033_remove_store_file.py b/pootle/apps/pootle_store/migrations/0033_remove_store_file.py
--- a/pootle/apps/pootle_store/migrations/0033_remove_store_file.py
+++ b/pootle/apps/pootle_store/migrations/0033_remove_store_file.py
@@ -8,6 +8,7 @@
 class Migration(migrations.Migration):
 
     dependencies = [
+        ('pootle_fs', '0002_convert_localfs'),
         ('pootle_store', '0032_fix_empty_wordcounts'),
     ]
 


Test patch: