Example #1
0
 def setUp(self):
     oc_settings = OpenClinicaSettings(
         domain=DOMAIN,
         study=StudySettings(
             is_ws_enabled=False,
             metadata=TEST_METADATA
         )
     )
     oc_settings.save()
 def setUp(self):
     oc_settings = OpenClinicaSettings(
         domain=DOMAIN,
         study=StudySettings(
             is_ws_enabled=False,
             metadata=TEST_METADATA
         )
     )
     oc_settings.save()
Example #3
0
 def save(self, domain):
     try:
         settings = OpenClinicaSettings.for_domain(domain.name)
         if settings is None:
             settings = OpenClinicaSettings(domain=domain.name)
         settings.study.is_ws_enabled = self.cleaned_data['is_ws_enabled']
         settings.study.url = self.cleaned_data['url']
         settings.study.username = self.cleaned_data['username']
         if self.cleaned_data['password']:
             # Simple symmetric encryption. We don't need it to be strong, considering we'd have to store the
             # algorithm and the key together anyway; it just shouldn't be plaintext.
             settings.study.password = b64encode(bz2.compress(self.cleaned_data['password']))
         settings.study.protocol_id = self.cleaned_data['protocol_id']
         settings.study.metadata = self.cleaned_data['metadata']
         settings.save()
         return True
     except Exception as err:
         logging.error('Unable to save OpenClinica settings: %s' % err)
         return False
Example #4
0
 def save(self, domain):
     try:
         settings = OpenClinicaSettings.for_domain(domain.name)
         if settings is None:
             settings = OpenClinicaSettings(domain=domain.name)
         settings.study.is_ws_enabled = self.cleaned_data['is_ws_enabled']
         settings.study.url = self.cleaned_data['url']
         settings.study.username = self.cleaned_data['username']
         if self.cleaned_data['password']:
             # Simple symmetric encryption. We don't need it to be strong, considering we'd have to store the
             # algorithm and the key together anyway; it just shouldn't be plaintext.
             settings.study.password = b64encode(bz2.compress(self.cleaned_data['password']))
         settings.study.protocol_id = self.cleaned_data['protocol_id']
         settings.study.metadata = self.cleaned_data['metadata']
         settings.save()
         return True
     except Exception as err:
         logging.error('Unable to save OpenClinica settings: %s' % err)
         return False