Example #1
0
 def validate(self, app=None, display_num_errors=False):
     s = StringIO()
     num_errors = get_validation_errors(s, app)
     if num_errors:
         s.seek(0)
         error_text = s.read()
         raise CommandError("One or more models did not validate:\n%s" % error_text)
     if display_num_errors:
         self.stdout.write("%s error%s found\n" 
             % (num_errors, num_errors != 1 and 's' or ''))
Example #2
0
 def validate(self, app=None, display_num_errors=False):
     s = StringIO()
     num_errors = get_validation_errors(s, app)
     if num_errors:
         s.seek(0)
         error_text = s.read()
         raise CommandError("One or more models did not validate:\n%s" %
                            error_text)
     if display_num_errors:
         self.stdout.write("%s error%s found\n" %
                           (num_errors, num_errors != 1 and 's' or ''))
Example #3
0
File: base.py Project: devhub/baph
    def validate(self, app=None, display_num_errors=False):
        """
        Validates the given app, raising CommandError for any errors.

        If app is None, then this will validate all installed apps.

        """
        from baph.core.management.validation import get_validation_errors
        s = StringIO()
        num_errors = get_validation_errors(s, app)
        if num_errors:
            s.seek(0)
            error_text = s.read()
            raise CommandError("One or more models did not validate:\n%s" % error_text)
        if display_num_errors:
            self.stdout.write("%s error%s found" % (num_errors, num_errors != 1 and 's' or ''))
Example #4
0
    def validate(self, app=None, display_num_errors=False):
        """
    Validates the given app, raising CommandError for any errors.

    If app is None, then this will validate all installed apps.
    """
        from baph.core.management.validation import get_validation_errors
        s = StringIO()
        num_errors = get_validation_errors(s, app)
        if num_errors:
            s.seek(0)
            error_text = s.read()
            raise base.CommandError(
                "One or more models did not validate:\n%s" % error_text)
        if display_num_errors:
            self.stdout.write("%s error%s found" %
                              (num_errors, num_errors != 1 and 's' or ''))