Ticket #6719: syncdb_better_error_messages.diff
File syncdb_better_error_messages.diff, 1.5 KB (added by , 17 years ago) |
---|
-
django/core/management/commands/syncdb.py
25 25 26 26 verbosity = int(options.get('verbosity', 1)) 27 27 interactive = options.get('interactive') 28 show_traceback = options.get('traceback', False) 28 29 29 30 self.style = no_style() 30 31 … … 110 111 for sql in custom_sql: 111 112 cursor.execute(sql) 112 113 except Exception, e: 113 sys.stderr.write("Failed to install custom SQL for %s.%s model: %s " % \114 sys.stderr.write("Failed to install custom SQL for %s.%s model: %s\n" % \ 114 115 (app_name, model._meta.object_name, e)) 116 if show_traceback: 117 import traceback 118 traceback.print_exc() 115 119 transaction.rollback_unless_managed() 116 120 else: 117 121 transaction.commit_unless_managed() 118 122 else: 123 if verbosity >= 2: 124 print "No custom SQL for %s.%s model" % (app_name, model._meta.object_name) 119 125 # Install SQL indicies for all newly created models 120 126 for app in models.get_apps(): 121 127 app_name = app.__name__.split('.')[-2]