def db_ensure_indexes():
 LOG.debug('Ensuring database indexes...')
 model_classes = get_model_classes()
 for model_class in model_classes:
  class_name = model_class.__name__
  LOG.debug(('Ensuring indexes for model "%s"...' % model_class.__name__))
  model_class.ensure_indexes()
  if (model_class.__name__ in INDEX_CLEANUP_MODEL_NAMES_BLACKLIST):
   LOG.debug(('Skipping index cleanup for blacklisted model "%s"...' % class_name))
   continue
  LOG.debug(('Removing extra indexes for model "%s"...' % class_name))
  removed_count = cleanup_extra_indexes(model_class=model_class)
  LOG.debug(('Removed "%s" extra indexes for model "%s"' % (removed_count, class_name)))

def db_ensure_indexes ( ) : LOG . debug ( 'Ensuring database indexes...' ) model_classes = get_model_classes ( ) for model_class in model_classes : class_name = model_class . __name__ LOG . debug ( ( 'Ensuring indexes for model "%s"...' % model_class . __name__ ) ) model_class . ensure_indexes ( ) if ( model_class . __name__ in INDEX_CLEANUP_MODEL_NAMES_BLACKLIST ) : LOG . debug ( ( 'Skipping index cleanup for blacklisted model "%s"...' % class_name ) ) continue LOG . debug ( ( 'Removing extra indexes for model "%s"...' % class_name ) ) removed_count = cleanup_extra_indexes ( model_class = model_class ) LOG . debug ( ( 'Removed "%s" extra indexes for model "%s"' % ( removed_count , class_name ) ) )
this function ensures that indexes for all the models have been created and the extra indexes cleaned up .