Skip to content

Commit

Permalink
Refs #4530. Fix for GeneratePythonScript.
Browse files Browse the repository at this point in the history
Handles case where non-default properties of the child algorithm to Load are
unable to be found via getPointerToProperty.
  • Loading branch information
PeterParker committed Jan 18, 2012
1 parent 6a5264a commit 9ac63a4
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions Code/Mantid/Framework/Algorithms/src/GeneratePythonScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,33 @@ std::string GeneratePythonScript::genParamString(
params += ",";
}

// Try and cast the property to a FileProperty type. If successful, we have to guard against
// the the occurence of directory separators (forward or back slashes) in the file path that the
// property contains. We do this by appending "r" onto the parameter in the output, to make it
// a Python "raw" string.
Property *p = ialg_Sptr->getPointerToProperty(name);
FileProperty* fp = dynamic_cast<FileProperty*> ((p));
if(NULL != fp)
{
params += name + "=r'" + value + "'";
if(algHistName == "Load")
{
if(propHist.type() == "string")
{
params += name + "=r'" + value + "'";
}
else
{
params += name + "='" + value + "'";
}
}
else
{
params += name + "='" + value + "'";
// Try and cast the property to a FileProperty type. If successful, we have to guard against
// the the occurence of directory separators (forward or back slashes) in the file path that the
// property contains. We do this by appending "r" onto the parameter in the output, to make it
// a Python "raw" string.
Property *p = ialg_Sptr->getPointerToProperty(name);
FileProperty* fp = dynamic_cast<FileProperty*> ((p));
if(NULL != fp)
{
params += name + "=r'" + value + "'";
}
else
{
params += name + "='" + value + "'";
}
}
}
}
Expand Down

0 comments on commit 9ac63a4

Please sign in to comment.