mirror of
https://github.com/django/django.git
synced 2025-04-25 17:54:37 +00:00
Fixed #9723 -- Not all Python distributions contain the bz2 module, so we need to allow for that. Based on a patch from AdamG.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8e68fc6cd1
commit
153b5a4a3a
@ -10,6 +10,12 @@ try:
|
|||||||
except NameError:
|
except NameError:
|
||||||
from sets import Set as set # Python 2.3 fallback
|
from sets import Set as set # Python 2.3 fallback
|
||||||
|
|
||||||
|
try:
|
||||||
|
import bz2
|
||||||
|
has_bz2 = True
|
||||||
|
except ImportError:
|
||||||
|
has_bz2 = False
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = 'Installs the named fixture(s) in the database.'
|
help = 'Installs the named fixture(s) in the database.'
|
||||||
args = "fixture [fixture ...]"
|
args = "fixture [fixture ...]"
|
||||||
@ -62,10 +68,11 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
compression_types = {
|
compression_types = {
|
||||||
None: file,
|
None: file,
|
||||||
'bz2': bz2.BZ2File,
|
|
||||||
'gz': gzip.GzipFile,
|
'gz': gzip.GzipFile,
|
||||||
'zip': SingleZipReader
|
'zip': SingleZipReader
|
||||||
}
|
}
|
||||||
|
if has_bz2:
|
||||||
|
compression_types['bz2'] = bz2.BZ2File
|
||||||
|
|
||||||
app_fixtures = [os.path.join(os.path.dirname(app.__file__), 'fixtures') for app in get_apps()]
|
app_fixtures = [os.path.join(os.path.dirname(app.__file__), 'fixtures') for app in get_apps()]
|
||||||
for fixture_label in fixture_labels:
|
for fixture_label in fixture_labels:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user