This commit is contained in:
hartvig
2011-02-28 13:03:58 -01:00
11 changed files with 29 additions and 16 deletions

View File

@@ -96,7 +96,7 @@ namespace umbraco.MacroEngines
if (macro.ScriptName.StartsWith("~"))
fileLocation = macro.ScriptName;
else
fileLocation = SystemDirectories.Python + "/" + macro.ScriptName;
fileLocation = SystemDirectories.MacroScripts + "/" + macro.ScriptName;
} else if (!string.IsNullOrEmpty(macro.ScriptCode) && !string.IsNullOrEmpty(macro.ScriptLanguage)) {
//Inline Razor Syntax
fileLocation = CreateInlineRazorFile(macro.ScriptCode, macro.ScriptLanguage);

View File

@@ -77,11 +77,24 @@ namespace umbraco.IO
}
}
[Obsolete("Please use MacroScripts instead!", true)]
public static string Python
{
get
{
return IOHelper.returnPath("umbracoPythonPath", "~/python");
return MacroScripts;
}
}
public static string MacroScripts
{
get
{
// for legacy we test for the python path first, but else we use the new default location
string tempPath = IOHelper.returnPath("umbracoPythonPath", "") == String.Empty
? IOHelper.returnPath("umbracoMacroScriptPath", "~/macroScripts")
: IOHelper.returnPath("umbracoPythonPath", "~/python");
return tempPath;
}
}

View File

@@ -121,7 +121,7 @@ namespace umbraco
{
try
{
string path = IOHelper.MapPath(SystemDirectories.Python + "/" + file);
string path = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + file);
object res = python.executeFile(path);
return res.ToString();
}

View File

@@ -1062,7 +1062,7 @@ namespace umbraco
}
else
{
string path = IOHelper.MapPath(SystemDirectories.Python + "/" + macro.ScriptName);
string path = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + macro.ScriptName);
IMacroEngine engine = MacroEngineFactory.GetByFilename(path);
ret.Text = engine.Execute(macro, Node.GetCurrent());
}

View File

@@ -43,7 +43,7 @@ namespace umbraco.scripting
Engine.AddToPath(path);
// Add umbracos python folder to python's path
path = IOHelper.MapPath(SystemDirectories.Python);
path = IOHelper.MapPath(SystemDirectories.MacroScripts);
Engine.AddToPath(path);
// execute the site.py to do all the initial stuff
@@ -58,7 +58,7 @@ namespace umbraco.scripting
private static void loadScripts()
{
scripts = new System.Collections.Hashtable();
string path = IOHelper.MapPath(SystemDirectories.Python);
string path = IOHelper.MapPath(SystemDirectories.MacroScripts);
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path);
foreach (System.IO.FileInfo f in dir.GetFiles("*.py"))
{

View File

@@ -54,7 +54,7 @@ namespace umbraco
{
get
{
return SystemDirectories.Python + "/";
return SystemDirectories.MacroScripts + "/";
}
}

View File

@@ -81,7 +81,7 @@ namespace umbraco
if (fileName.Contains("/")) //if there's a / create the folder structure for it
{
string[] folders = fileName.Split("/".ToCharArray());
string basePath = IOHelper.MapPath(SystemDirectories.Python);
string basePath = IOHelper.MapPath(SystemDirectories.MacroScripts);
for (int i = 0; i < folders.Length - 1; i++)
{
basePath = System.IO.Path.Combine(basePath, folders[i]);
@@ -89,7 +89,7 @@ namespace umbraco
}
}
string abFileName = IOHelper.MapPath(SystemDirectories.Python + "/" + fileName);
string abFileName = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + fileName);
System.IO.StreamWriter scriptWriter = System.IO.File.CreateText(abFileName);
scriptWriter.Write(scriptContent);
@@ -111,7 +111,7 @@ namespace umbraco
public bool Delete()
{
string path = IOHelper.MapPath(SystemDirectories.Python + "/" + Alias.TrimStart('/'));
string path = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + Alias.TrimStart('/'));
System.Web.HttpContext.Current.Trace.Warn("", "*" + path + "*");
try

View File

@@ -205,7 +205,7 @@ namespace umbraco.cms.presentation.developer
private void populatePythonFiles()
{
ArrayList pythons = new ArrayList();
string pythonDir = IOHelper.MapPath(SystemDirectories.Python + "/");
string pythonDir = IOHelper.MapPath(SystemDirectories.MacroScripts + "/");
getPythonFilesFromDir(pythonDir, pythonDir, pythons);
pythonFiles.DataSource = pythons;
pythonFiles.DataBind();

View File

@@ -51,7 +51,7 @@ namespace umbraco.cms.presentation.developer
StreamReader SR;
string S;
SR = File.OpenText( IOHelper.MapPath(SystemDirectories.Python + "/" + file));
SR = File.OpenText(IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + file));
S = SR.ReadToEnd();
SR.Close();
pythonSource.Text = S;

View File

@@ -234,7 +234,7 @@ namespace umbraco.presentation.webservices
public string SaveDLRScript(string fileName, string oldName, string fileContents, bool ignoreDebugging)
{
StreamWriter SW;
string tempFileName = IOHelper.MapPath(SystemDirectories.Python + "/" + System.DateTime.Now.Ticks.ToString() + "_" + fileName);
string tempFileName = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + System.DateTime.Now.Ticks.ToString() + "_" + fileName);
//SW = File.CreateText(tempFileName);
@@ -269,9 +269,9 @@ namespace umbraco.presentation.webservices
if (errorMessage == "")
{
//Hardcoded security-check... only allow saving files in xslt directory...
string savePath = IOHelper.MapPath(SystemDirectories.Python + "/" + fileName);
string savePath = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + fileName);
if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Python + "/")))
if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.MacroScripts + "/")))
{
SW = new System.IO.StreamWriter(savePath, false, Encoding.UTF8);
SW.Write(fileContents);
@@ -281,7 +281,7 @@ namespace umbraco.presentation.webservices
//deletes the old xslt file
if (fileName != oldName)
{
string p = IOHelper.MapPath(SystemDirectories.Python + "/" + oldName);
string p = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + oldName);
if (System.IO.File.Exists(p))
System.IO.File.Delete(p);
}