diff options
| author | Justin Bronn <jbronn@gmail.com> | 2008-02-28 21:24:51 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2008-02-28 21:24:51 +0000 |
| commit | 22e016ff6c18a35a450519b94de63033f83e6b4f (patch) | |
| tree | 1e58cc40a636b4e4f3dcf429a5a116c015c36278 /django/core/management/commands | |
| parent | 0b52413cc926446f238fd781b4def6804f64d231 (diff) | |
gis: Merged revisions 7105-7168 via svnmerge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7176 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/management/commands')
| -rw-r--r-- | django/core/management/commands/loaddata.py | 20 | ||||
| -rw-r--r-- | django/core/management/commands/sqlall.py | 2 |
2 files changed, 14 insertions, 8 deletions
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index e95be6b8d7..dde9e6eb80 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -30,7 +30,8 @@ class Command(BaseCommand): show_traceback = options.get('traceback', False) # Keep a count of the installed objects and fixtures - count = [0, 0] + fixture_count = 0 + object_count = 0 models = set() humanize = lambda dirname: dirname and "'%s'" % dirname or 'absolute path' @@ -65,7 +66,12 @@ class Command(BaseCommand): else: print "Skipping fixture '%s': %s is not a known serialization format" % (fixture_name, format) - for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']: + if os.path.isabs(fixture_name): + fixture_dirs = [fixture_name] + else: + fixture_dirs = app_fixtures + list(settings.FIXTURE_DIRS) + [''] + + for fixture_dir in fixture_dirs: if verbosity > 1: print "Checking %s for fixtures..." % humanize(fixture_dir) @@ -86,14 +92,14 @@ class Command(BaseCommand): transaction.leave_transaction_management() return else: - count[1] += 1 + fixture_count += 1 if verbosity > 0: print "Installing %s fixture '%s' from %s." % \ (format, fixture_name, humanize(fixture_dir)) try: objects = serializers.deserialize(format, fixture) for obj in objects: - count[0] += 1 + object_count += 1 models.add(obj.object.__class__) obj.save() label_found = True @@ -113,7 +119,7 @@ class Command(BaseCommand): print "No %s fixture '%s' in %s." % \ (format, fixture_name, humanize(fixture_dir)) - if count[0] > 0: + if object_count > 0: sequence_sql = connection.ops.sequence_reset_sql(self.style, models) if sequence_sql: if verbosity > 1: @@ -124,9 +130,9 @@ class Command(BaseCommand): transaction.commit() transaction.leave_transaction_management() - if count[0] == 0: + if object_count == 0: if verbosity >= 2: print "No fixtures found." else: if verbosity > 0: - print "Installed %d object(s) from %d fixture(s)" % tuple(count) + print "Installed %d object(s) from %d fixture(s)" % (object_count, fixture_count) diff --git a/django/core/management/commands/sqlall.py b/django/core/management/commands/sqlall.py index d63dfb4b10..bf3c734bb6 100644 --- a/django/core/management/commands/sqlall.py +++ b/django/core/management/commands/sqlall.py @@ -1,7 +1,7 @@ from django.core.management.base import AppCommand class Command(AppCommand): - help = "Prints the CREATE TABLE, initial-data and CREATE INDEX SQL statements for the given model module name(s)." + help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s)." output_transaction = True |
