Django

Code

Changeset 6022

Show
Ignore:
Timestamp:
08/26/07 19:30:37 (1 year ago)
Author:
adrian
Message:

Changed 'validate' and 'runserver' management commands to display the number of errors. This was previous behavior before the management.py refactoring

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management/base.py

    r5965 r6022  
    4545            sys.exit(1) 
    4646 
    47     def validate(self, app=None): 
     47    def validate(self, app=None, display_num_errors=False): 
    4848        """ 
    4949        Validates the given app, raising CommandError for any errors. 
     
    6262            error_text = s.read() 
    6363            raise CommandError("One or more models did not validate:\n%s" % error_text) 
     64        if display_num_errors: 
     65            print "%s error%s found" % (num_errors, num_errors != 1 and 's' or '') 
    6466 
    6567    def handle(self, *args, **options): 
  • django/trunk/django/core/management/commands/runserver.py

    r6001 r6022  
    3838            from django.conf import settings 
    3939            print "Validating models..." 
    40             self.validate(
     40            self.validate(display_num_errors=True
    4141            print "\nDjango version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE) 
    4242            print "Development server is running at http://%s:%s/" % (addr, port) 
  • django/trunk/django/core/management/commands/validate.py

    r5903 r6022  
    77 
    88    def handle_noargs(self, **options): 
    9         self.validate(
     9        self.validate(display_num_errors=True