@register
def validate_fun_facts():
 for fact in FunFact.objects.published():
  try:
   _validate_query(fact.number)
   if fact.divisor:
    _validate_query(fact.divisor)
  except ValidationError:
   logger.error(('Unpublishing fact "%s"' % fact.name))
   fact.published = False
   fact.save()

@ register def validate_fun_facts ( ) : for fact in FunFact . objects . published ( ) : try : _validate_query ( fact . number ) if fact . divisor : _validate_query ( fact . divisor ) except ValidationError : logger . error ( ( 'Unpublishing fact "%s"' % fact . name ) ) fact . published = False fact . save ( )
validate all published facts and unpublish those failing .