Example #1
0
 def clean_destination_folder(self):
     sf = self.cleaned_data['scan_folder']
     df = self.cleaned_data['destination_folder']
     df = df.rstrip('/')  # Remove tailing slash (Linux)
     validate.folder_exists(df)  # Validate destination exists
     validate.folder_writable(df)  # Validate destination is writable
     if df == sf:  # Validate source and destination are not the same
         raise ValidationError(
             'Scan and Destination folders cannot be the same')
     return df
Example #2
0
 def clean_scan_folder(self):
     sf = self.cleaned_data['scan_folder']
     sf = sf.rstrip('/')  # Remove trailing slash (Linux)
     validate.folder_exists(sf)  # Validate scan folder exists
     return sf
Example #3
0
 def test_validate_folder_exists(self):
     missingfolder = '/bogus'
     self.assertRaises(ValidationError, \
                       lambda: validate.folder_exists(missingfolder))
Example #4
0
 def test_validate_folder_exists(self):
     missingfolder = '/bogus'
     self.assertRaises(ValidationError, \
                       lambda: validate.folder_exists(missingfolder))