def __call__(self, attrs):
     data = {
         prop: value for prop, value in attrs.items()
         if prop in self.fields}
     if not data:
         return
     request = self.context.get('request')
     request_meta = getattr(request, 'META', {})
     reports = get_collection_akismet_reports(
         user=getattr(request, 'user', None),
         user_agent=request_meta.get('HTTP_USER_AGENT'),
         referrer=request_meta.get('HTTP_REFERER'),
         collection=self.serializer.instance,
         data=data)
     if any((report.comment_check() for report in reports)):
         # We have to serialize and send it off to a task because the DB
         # transaction will be rolled back because of the ValidationError.
         save_akismet_report.delay(object_serialize("json", reports))
         raise serializers.ValidationError(ugettext(
             'The text entered has been flagged as spam.'))
 def __call__(self, attrs):
     data = {
         prop: value
         for prop, value in attrs.items() if prop in self.fields
     }
     if not data:
         return
     request = self.context.get('request')
     request_meta = getattr(request, 'META', {})
     reports = get_collection_akismet_reports(
         user=getattr(request, 'user', None),
         user_agent=request_meta.get('HTTP_USER_AGENT'),
         referrer=request_meta.get('HTTP_REFERER'),
         collection=self.serializer.instance,
         data=data)
     if any((report.comment_check() for report in reports)):
         # We have to serialize and send it off to a task because the DB
         # transaction will be rolled back because of the ValidationError.
         save_akismet_report.delay(object_serialize("json", reports))
         raise serializers.ValidationError(
             ugettext('The text entered has been flagged as spam.'))