我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用django.core.checks.ERROR。
def __init__(self, stdout=None, stderr=None, no_color=False): self.stdout = OutputWrapper(stdout or sys.stdout) self.stderr = OutputWrapper(stderr or sys.stderr) if no_color: self.style = no_style() else: self.style = color_style() self.stderr.style_func = self.style.ERROR # `requires_model_validation` is deprecated in favor of # `requires_system_checks`. If both options are present, an error is # raised. Otherwise the present option is used. If none of them is # defined, the default value (True) is used. has_old_option = hasattr(self, 'requires_model_validation') has_new_option = hasattr(self, 'requires_system_checks') if has_old_option: warnings.warn( '"requires_model_validation" is deprecated ' 'in favor of "requires_system_checks".', RemovedInDjango19Warning) if has_old_option and has_new_option: raise ImproperlyConfigured( 'Command %s defines both "requires_model_validation" ' 'and "requires_system_checks", which is illegal. Use only ' '"requires_system_checks".' % self.__class__.__name__) self.requires_system_checks = ( self.requires_system_checks if has_new_option else self.requires_model_validation if has_old_option else True)