~vinay-sajip/django/logging

« back to all changes in this revision

Viewing changes to django/core/management/base.py

  • Committer: Vinay Sajip
  • Date: 2010-06-01 13:15:56 UTC
  • mfrom: (52.1.11 upstream)
  • Revision ID: vinay_sajip@yahoo.co.uk-20100601131556-xiz6hh28mgngv4w7
Merged upstream SVN r13315.

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
            output = self.handle(*args, **options)
219
219
            if output:
220
220
                if self.output_transaction:
221
 
                    # This needs to be imported here, because it relies on settings.
222
 
                    from django.db import connection
 
221
                    # This needs to be imported here, because it relies on
 
222
                    # settings.
 
223
                    from django.db import connections, DEFAULT_DB_ALIAS
 
224
                    connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
223
225
                    if connection.ops.start_transaction_sql():
224
226
                        print self.style.SQL_KEYWORD(connection.ops.start_transaction_sql())
225
227
                print output
226
228
                if self.output_transaction:
227
 
                    print self.style.SQL_KEYWORD("COMMIT;")
 
229
                    print self.style.SQL_KEYWORD(connection.ops.end_transaction_sql())
228
230
        except CommandError, e:
229
231
            sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
230
232
            sys.exit(1)