Skip to content
Snippets Groups Projects
Commit a3e8ceac authored by Romain Therville's avatar Romain Therville :coffee:
Browse files

Merge branch 'issue#190' into 'master'

Update to the analysis.py class

See merge request !111
parents f97bc74a b2a5c34d
No related branches found
No related tags found
1 merge request!111Update to the analysis.py class
......@@ -752,6 +752,16 @@ class Analysis (Component):
return [retcode, str_cmd]
def get_directory(self):
"""
Returns a analysis's directory
"""
if self.id != None :
t3mysql = t3MySQLdb()
return t3mysql.select_analysis_directory(self.id)
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
else:
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment