'Upon errors from the Akismet API records the user, document
and date of the attempt for further analysis. Then call the
parent class\' error handler.'

def akismet_error(self, parameters, exception=None):

    try:
        document = self.instance.document
    except ObjectDoesNotExist:
        document = None
    if (exception and isinstance(exception, AkismetError)):
        dsa_params = parameters.copy()
        dsa_params['akismet_status_code'] = exception.status_code
        dsa_params['akismet_debug_help'] = exception.debug_help
        dsa_params['akismet_response'] = exception.response.content
        review = DocumentSpamAttempt.AKISMET_ERROR
    else:
        dsa_params = parameters
        review = DocumentSpamAttempt.NEEDS_REVIEW
    try:
        DocumentSpamAttempt.objects.create(title=self.cleaned_data['title'], slug=self.cleaned_data['slug'], user=self.request.user, document=document, data=json.dumps(dsa_params, indent=2, sort_keys=True), review=review)
    finally:
        if (not waffle.flag_is_active(self.request, SPAM_TRAINING_FLAG)):
            super(RevisionForm, self).akismet_error(parameters, exception)
