+ boxx = forms.FloatField(label='Box X',initial=1000.0,
+ help_text='box x dimension')
+ boxy = forms.FloatField(label='Box Y',initial=1000.0,
+ help_text='box y dimension')
+ boxz = forms.FloatField(label='Box Z',initial=1000.0,
+ help_text='box z dimension')
+
+ def clean(self):
+ cleaned_data = super(TaskForm_min_a, self).clean()
+
+ pdbid = cleaned_data.get("pdbid")
+ file1 = cleaned_data.get("file1")
+
+ if not pdbid and not file1:
+ msg = 'provide pdb file or pdb code'
+ self.add_error('file1', msg)
+
+ if pdbid:
+ test=urllib.urlopen('http://files.rcsb.org/download/'+pdbid+'.pdb')
+ if test.code != 200:
+ msg = 'wrong pdb code'
+ self.add_error('pdbid', msg)
+ else:
+ msg=pdb_missing_res(test)
+ if msg != '':
+ self.add_error('pdbid',msg)
+ test.close()
+
+ if file1:
+ msg=pdb_missing_res(file1)
+ if msg != '':
+ self.add_error('file1',msg)