def fix_bad_data(django_obj, dirty):
 if isinstance(django_obj, models.Node):
  if (django_obj.title.strip() == u''):
   django_obj.title = u'Blank Title'
   dirty = True
 if isinstance(django_obj, models.Embargo):
  if (django_obj.state == u'active'):
   django_obj.state = u'completed'
   dirty = True
  elif (django_obj.state == u'cancelled'):
   django_obj.state = u'rejected'
   dirty = True
 if isinstance(django_obj, models.Retraction):
  if (django_obj.state == u'cancelled'):
   django_obj.state = u'rejected'
   dirty = True
  if (django_obj.state == u'retracted'):
   django_obj.state = u'completed'
   dirty = True
  if (django_obj.state == u'pending'):
   django_obj.state = u'unapproved'
   dirty = True
 return (django_obj, dirty)

def fix_bad_data ( django_obj , dirty ) : if isinstance ( django_obj , models . Node ) : if ( django_obj . title . strip ( ) == u'' ) : django_obj . title = u'Blank Title' dirty = True if isinstance ( django_obj , models . Embargo ) : if ( django_obj . state == u'active' ) : django_obj . state = u'completed' dirty = True elif ( django_obj . state == u'cancelled' ) : django_obj . state = u'rejected' dirty = True if isinstance ( django_obj , models . Retraction ) : if ( django_obj . state == u'cancelled' ) : django_obj . state = u'rejected' dirty = True if ( django_obj . state == u'retracted' ) : django_obj . state = u'completed' dirty = True if ( django_obj . state == u'pending' ) : django_obj . state = u'unapproved' dirty = True return ( django_obj , dirty )
this fixes a bunch of validation errors that happen during the migration .