From 50b59c4874265110234976367838df067989e27b Mon Sep 17 00:00:00 2001
From: Bastian Kleineidam <calvin@debian.org>
Date: Mon, 28 Jan 2008 08:33:09 +0100
Subject: Support gzipped fixture data
Signed-off-by: Bastian Kleineidam <calvin@debian.org>
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index fb03259..d47e65f 100644
|
a
|
b
|
from django.core.management.color import no_style
|
| 3 | 3 | from optparse import make_option |
| 4 | 4 | import sys |
| 5 | 5 | import os |
| | 6 | import gzip |
| 6 | 7 | |
| 7 | 8 | try: |
| 8 | 9 | set |
| … |
… |
class Command(BaseCommand):
|
| 77 | 78 | (humanize(fixture_dir), format, fixture_name) |
| 78 | 79 | try: |
| 79 | 80 | full_path = os.path.join(fixture_dir, '.'.join([fixture_name, format])) |
| 80 | | fixture = open(full_path, 'r') |
| | 81 | if os.path.exists(full_path+".gz"): |
| | 82 | full_path += ".gz" |
| | 83 | fixture = gzip.open(full_path) |
| | 84 | else: |
| | 85 | fixture = open(full_path, 'r') |
| 81 | 86 | if label_found: |
| 82 | 87 | fixture.close() |
| 83 | 88 | print self.style.ERROR("Multiple fixtures named '%s' in %s. Aborting." % |