Added Workflow.get_data_file_name() which returns the full path to a given

data file, or None if the file does not exist. This is tested in the test
workflow.
This commit is contained in:
2007-02-28 14:56:24 +00:00
parent 934640ea62
commit 89636962a7
2 changed files with 30 additions and 0 deletions
+13
View File
@@ -63,6 +63,19 @@ class Workflow:
self.stages_by_id = {}
self.app = app
def get_data_file_name(self, filename):
"""Checks if a file with the given name exists in the data directory.
Returns the file name if the file exists in the data directory, which
is defined as datadir/workflowname. If the file does not exist, or the
workflow does not have an identificator, this method returns None."""
print os.path.join(self.app.options.datadir, self.ident, filename)
if self.ident == None:
return None
fn = os.path.join(self.app.options.datadir, self.ident, filename)
if os.path.isfile(fn):
return fn
return None
def add_stage(self, stage):
self.stages.append(stage)
self.stages_by_id[stage.id] = stage