#NEWLINE# def check_plausibility( args = [ ] , fix = True ) : #NEWLINE# #INDENT# 'Called by :manage:`check_plausibility`. See there.' #NEWLINE# Problem = rt . modules . plausibility . Problem #NEWLINE# mc = get_checkable_models ( * args ) #NEWLINE# with translation . override ( 'en' ) : #NEWLINE# #INDENT# for ( m , checkers ) in mc . items ( ) : #NEWLINE# #INDENT# ct = rt . modules . contenttypes . ContentType . objects . get_for_model ( m ) #NEWLINE# Problem . objects . filter ( owner_type = ct ) . delete ( ) #NEWLINE# name = unicode ( m . _meta . verbose_name_plural ) #NEWLINE# qs = m . objects . all ( ) #NEWLINE# msg = 'Running {0} plausibility checkers on {1} {2}...' . format ( len ( checkers ) , qs . count ( ) , name ) #NEWLINE# puts ( msg ) #NEWLINE# sums = [ 0 , 0 , name ] #NEWLINE# for obj in progress . bar ( qs ) : #NEWLINE# #INDENT# for chk in checkers : #NEWLINE# #INDENT# ( todo , done ) = chk . update_problems ( obj , False , fix ) #NEWLINE# sums [ 0 ] += len ( todo ) #NEWLINE# sums [ 1 ] += len ( done ) #NEWLINE# #UNINDENT# #UNINDENT# if ( sums [ 0 ] or sums [ 1 ] ) : #NEWLINE# #INDENT# msg = 'Found {0} and fixed {1} plausibility problems in {2}.' #NEWLINE# puts ( msg . format ( * sums ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# puts ( 'No plausibility problems found in {0}.' . format ( name ) )