Esempio n. 1
0
    def validate_matlab_path(self, **data):
        """
        Check if the set path from the ui actually corresponds to a matlab executable.
        """
        submitted_path = data[self.settingsservice.KEY_MATLAB_EXECUTABLE]
        if len(submitted_path) == 0:
            return {
                'status':
                'ok',
                'message':
                'No Matlab/Ocatve path was given. Some analyzers will not be available.'
            }

        if os.path.isfile(submitted_path):
            version = check_matlab_version(submitted_path)
            if version:
                return {
                    'status':
                    'ok',
                    'message':
                    "Valid Matlab/Octave. Found version: '%s'." % (version, )
                }
            else:
                return {
                    'status':
                    'not ok',
                    'message':
                    "Invalid Matlab/Octave. Found version: '%s' ." %
                    (version, )
                }
        else:
            return {
                'status': 'not ok',
                'message': 'Invalid Matlab/Octave path.'
            }
Esempio n. 2
0
 def _convert_to_python(self, value, _):
     """ 
     Validation method for the Matlab Path.
     """
     version = check_matlab_version(value)
     if version:
         return value
     else:
         raise formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
 def _convert_to_python(self, value, _):
     """ 
     Validation method for the Matlab Path.
     """
     version = check_matlab_version(value)
     if version:
         return value
     else:
         raise formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
 def _to_python(self, value, _):
     """ 
     Validation required method.
     """
     try:
         version = check_matlab_version(value)
         if len(version) > 0:
             return value
         else:
             formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
     except Exception:
         raise formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
 def _convert_to_python(self, value, _):
     """ 
     Validation required method.
     """
     try:
         version = check_matlab_version(value)
         if len(version) > 0:
             return value
         else:
             raise formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
     except Exception:
         raise formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
 def validate_matlab_path(self, **data):
     """
     Check if the set path from the ui actually corresponds to a matlab executable.
     """
     submitted_path = data[self.settingsservice.KEY_MATLAB_EXECUTABLE]
     if len(submitted_path) == 0:
         return {'status': 'ok',
                 'message': 'No Matlab/Ocatve path was given. Some analyzers will not be available.'}
     if os.path.isfile(submitted_path):
         version = check_matlab_version(submitted_path)
         return {'status': 'ok', 'message': 'Valid Matlab/Octave. Found version: %s.' % (version,)}
     else:
         return {'status': 'not ok', 'message': 'Invalid Matlab/Octave path.'}
 def _convert_to_python(self, value, _):
     """ 
     Validation method for the Matlab Path.
     """
     try:
         version = check_matlab_version(value)
         if version:
             return value
         else:
             raise formencode.Invalid('No valid matlab installation was found at the path you provided.', '', None)
     except Exception:
         raise formencode.Invalid('An exception was thrown when trying to validate Matlab. \n'
                                  'Try a different path, or empty.', '', None)
Esempio n. 8
0
 def _convert_to_python(self, value, _):
     """ 
     Validation method for the Matlab Path.
     """
     try:
         version = check_matlab_version(value)
         if version:
             return value
         else:
             raise formencode.Invalid(
                 'No valid matlab installation was found at the path you provided.',
                 '', None)
     except Exception:
         raise formencode.Invalid(
             'An exception was thrown when trying to validate Matlab. \n'
             'Try a different path, or empty.', '', None)