Exemple #1
0
    def get_initial(self):
        pdb_info = get_pdb_info(self.request.session['entry_id'])

        initial = super(StepTwoView, self).get_initial()
        initial.update(pdb_info)
        
        return initial
Exemple #2
0
    def clean(self):
        file_source = int(self.cleaned_data["file_source"])
        entry_id = self.cleaned_data["entry_id"]

        if file_source == self.FILE_REMOTE:
            if not get_pdb_info(entry_id):
                raise forms.ValidationError("PDB id does not exist in RCSB.")
        elif file_source == self.FILE_LOCAL:
            task = send_task("virus.check_file_count", args=[entry_id])

            if task.get() is not 2:
                raise forms.ValidationError("PDB and/or CIF file not found locally.")
        elif file_source == self.FILE_UPLOAD:
            pass

        return self.cleaned_data