def spam(self, record):
        """This is where the magic happens and AbstractRecords evolve."""

        log.debug('[ --> Spam %s ]' % record)
        self.current = record

        if record.is_app():
            for model in self.appmodels.get(str(record)):
                record.model = model
                record.create_object()
                record.field = None
                self.spam(record)

        elif record.is_model():
            for field in [field for field \
                in record.model._meta.fields \
                if not field.auto_created]:

                record.many_to_many = False
                record.field = field
                self.spam(record)
            record.save()
            self.rows_affected += 1

            # after the record is saved, it is safe to fill
            # ManyToMany fields if any

            for field in record.model._meta.many_to_many:
                record.field = field
                record.many_to_many = True
                self.spam(record)

        elif record.is_field():
            if record.field.blank and (self.use_coin and self._coin_toss()):
                self.fields_omitted += 1
                log.debug("Using coin -- simon says, skip this record.")
                return

            handler = self.find_spam_handler(record)
            if handler is not None:
                value = handler(record, record.field)
                if record.field.unique:
                    manager = record.model._default_manager

                    # handlers may not return random values,
                    # try 5 times before giving up

                    for i in range(5):
                        try:
                            _match = manager.get(**{record.field.name: value})
                            value = handler(record, record.field)
                        except record.model.DoesNotExist, e:
                            break

                record.set_object_property(value)
                self.fields_spammed += 1
            else:
                log.warn("Handler not found for %s" % record)
dataset/ETHPy150Open aerosol/django-dilla/dilla/__init__.py/Dilla.spam/original