Commit b2a5c34d authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Update to the class

New get_directory() function for the class.

issue #129
parent 5a90f603
......@@ -752,6 +752,16 @@ class Analysis (Component):
return [retcode, str_cmd]
def get_directory(self):
Returns a analysis's directory
if != None :
t3mysql = t3MySQLdb()
return t3mysql.select_analysis_directory(
else :
raise UnsavedAnalysisError()
def get_web_filepath(self, file_name, base_filepath='fileadmin' ):
returns the full web filepath from a given filename
......@@ -759,7 +769,8 @@ def get_web_filepath(self, file_name, base_filepath='fileadmin' ):
@param base_filepath : the first directory in the path (depends on the server's directory structure)
@return : the full web filepath
logging.getLogger("Analysis.get_web_filepath").debug("IN analysis.get_web_filepath()")
return base_filepath + os.path.join(self.get_directory(), file_name)
......@@ -35,4 +35,17 @@ class UnsavedRunError(Exception):
def __str__(self):
return repr(self.message)
\ No newline at end of file
class UnsavedAnalysisError(Exception):
Exception to be raised when an operation is performed and the analysis has not been saved yet
def __init__(self, message=None):
if message is not None:
self.message = message
self.message = "The analysis has to be saved before to call this method."
def __str__(self):
return repr(self.message)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment