示例#1
0
 def clean_key(self):
     key = self.cleaned_data.get('key')
     report = self.report
     try:
         decrypted_report = report.decrypted_report(key)
         self.decrypted_report = decrypted_report
         #save anonymous row if one wasn't saved on creation
         try:
             row = EvalRow()
             row.set_identifiers(report)
             if (EvalRow.objects.filter(
                     record_identifier=row.record_identifier).count() == 0):
                 row.action = EvalRow.FIRST
                 row.add_report_data(decrypted_report)
                 row.save()
         except Exception:
             logger.exception(
                 "couldn't save anonymous row on catch-up save")
             pass
     except CryptoError:
         self.decrypted_report = None
         logger.info("decryption failure on report {}".format(report.id))
         raise forms.ValidationError(
             self.error_messages['wrong_key'],
             code='wrong_key',
         )
     return key
示例#2
0
 def clean_key(self):
     key = self.cleaned_data.get('key')
     report = self.report
     try:
         decrypted_report = report.decrypted_report(key)
         self.decrypted_report = decrypted_report
         #save anonymous row if one wasn't saved on creation
         try:
             row = EvalRow()
             row.set_identifiers(report)
             if (EvalRow.objects.filter(record_identifier = row.record_identifier).count() == 0):
                 row.action = EvalRow.FIRST
                 row.add_report_data(decrypted_report)
                 row.save()
         except Exception as e:
             #TODO: real logging
             bugsnag.notify(e)
             pass
     except CryptoError:
         self.decrypted_report = None
         raise forms.ValidationError(
             self.error_messages['wrong_key'],
             code='wrong_key',
         )
     return key
示例#3
0
 def clean_key(self):
     key = self.cleaned_data.get('key')
     report = self.report
     try:
         decrypted_report = report.decrypted_report(key)
         self.decrypted_report = decrypted_report
         #save anonymous row if one wasn't saved on creation
         try:
             row = EvalRow()
             row.set_identifiers(report)
             if (EvalRow.objects.filter(
                     record_identifier=row.record_identifier).count() == 0):
                 row.action = EvalRow.FIRST
                 row.add_report_data(decrypted_report)
                 row.save()
         except Exception as e:
             #TODO: real logging
             bugsnag.notify(e)
             pass
     except CryptoError:
         self.decrypted_report = None
         raise forms.ValidationError(
             self.error_messages['wrong_key'],
             code='wrong_key',
         )
     return key
示例#4
0
 def clean_key(self):
     key = self.cleaned_data.get('key')
     report = self.report
     try:
         decrypted_report = report.decrypted_report(key)
         self.decrypted_report = decrypted_report
         #save anonymous row if one wasn't saved on creation
         try:
             row = EvalRow()
             row.set_identifiers(report)
             if (EvalRow.objects.filter(record_identifier = row.record_identifier).count() == 0):
                 row.action = EvalRow.FIRST
                 row.add_report_data(decrypted_report)
                 row.save()
         except Exception:
             logger.exception("couldn't save anonymous row on catch-up save")
             pass
     except CryptoError:
         self.decrypted_report = None
         logger.info("decryption failure on report {}".format(report.id))
         raise forms.ValidationError(
             self.error_messages['wrong_key'],
             code='wrong_key',
         )
     return key