Changeset 257
- Timestamp:
- 11/30/08 18:59:56 (1 month ago)
- Files:
-
- trunk/spark.build (modified) (1 diff)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/Castle.MonoRail.Views.Spark.Tests.csproj (modified) (4 diffs)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/ModelDictionaryTests.cs (modified) (1 diff)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/Models (added)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/Models/UserInfo.cs (added)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/MonoRail.Tests.Views/Home/NullBehaviourConfiguredToLenient.spark (added)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/MonoRail.Tests.Views/Home/NullBehaviourConfiguredToStrict_RegularConstruct.spark (added)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/MonoRail.Tests.Views/Home/NullBehaviourConfiguredToStrict_SuppressNullsConstruct.spark (added)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/PrecompileInstallerTests.cs (modified) (1 diff)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkBatchCompilerTester.cs (modified) (1 diff)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkViewFactoryStrictNullBehaviourTests.cs (added)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkViewFactoryTests.cs (modified) (2 diffs)
- trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkViewFactoryTestsBase.cs (added)
- trunk/src/CommonAssemblyInfo.cs (modified) (1 diff)
- trunk/src/Spark.Python (modified) (1 prop)
- trunk/src/Spark.Python/ScriptingLanguageFactory.cs (modified) (1 diff)
- trunk/src/Spark.Ruby/RubyLanguageFactory.cs (modified) (1 diff)
- trunk/src/Spark.Tests/App.config (modified) (1 diff)
- trunk/src/Spark.Tests/SparkSectionHandlerTester.cs (modified) (3 diffs)
- trunk/src/Spark.Tests/SparkViewFactoryTester.cs (modified) (1 diff)
- trunk/src/Spark/Compiler/CSharp/ChunkVisitors/GeneratedCodeVisitor.cs (modified) (6 diffs)
- trunk/src/Spark/Compiler/CSharp/ChunkVisitors/GlobalMembersVisitor.cs (modified) (2 diffs)
- trunk/src/Spark/Compiler/CSharp/DefaultViewCompiler.cs (modified) (2 diffs)
- trunk/src/Spark/Compiler/ViewCompiler.cs (modified) (1 diff)
- trunk/src/Spark/Configuration/CompilationElement.cs (modified) (2 diffs)
- trunk/src/Spark/Configuration/SparkSectionHandler.cs (modified) (1 diff)
- trunk/src/Spark/DefaultLanguageFactory.cs (modified) (1 diff)
- trunk/src/Spark/ISparkSettings.cs (modified) (1 diff)
- trunk/src/Spark/SparkSettings.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/spark.build
r246 r257 124 124 </categories> 125 125 </test> 126 <test assemblyname="${build.dir}/Spark.Ruby.Tests.dll"> 127 <categories> 128 <exclude name="Integration" /> 129 </categories> 130 </test> 131 <test assemblyname="${build.dir}/Spark.Python.Tests.dll"> 132 <categories> 133 <exclude name="Integration" /> 134 </categories> 135 </test> 136 <test assemblyname="${build.dir}/Spark.Web.Mvc.Ruby.Tests.dll"> 137 <categories> 138 <exclude name="Integration" /> 139 </categories> 140 </test> 126 141 </nunit2> 127 142 </target> trunk/src/Castle.MonoRail.Views.Spark.Tests/Castle.MonoRail.Views.Spark.Tests.csproj
r217 r257 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 21022</ProductVersion>6 <ProductVersion>9.0.30729</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{AD93C831-E12E-45AE-B654-682F9EFAE314}</ProjectGuid> … … 78 78 <Compile Include="Helpers\HomeController.cs" /> 79 79 <Compile Include="ModelDictionaryTests.cs" /> 80 <Compile Include="Models\UserInfo.cs" /> 80 81 <Compile Include="PrecompileInstallerTests.cs" /> 81 82 <Compile Include="Properties\AssemblyInfo.cs" /> 82 83 <Compile Include="SparkBatchCompilerTester.cs" /> 83 84 <Compile Include="SparkViewDataTests.cs" /> 85 <Compile Include="SparkViewFactoryStrictNullBehaviourTests.cs" /> 84 86 <Compile Include="SparkViewFactoryTests.cs" /> 87 <Compile Include="SparkViewFactoryTestsBase.cs" /> 85 88 <Compile Include="Stubs\StubController.cs" /> 86 89 <Compile Include="ViewComponents\AllFrameworkComponentTests.cs" /> … … 178 181 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 179 182 </None> 183 <None Include="MonoRail.Tests.Views\Home\NullBehaviourConfiguredToStrict_RegularConstruct.spark"> 184 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 185 </None> 186 <None Include="MonoRail.Tests.Views\Home\NullBehaviourConfiguredToStrict_SuppressNullsConstruct.spark"> 187 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 188 </None> 180 189 <None Include="MonoRail.Tests.Views\Home\ComponentBodySimpleHtml.spark"> 181 190 <CopyToOutputDirectory>Always</CopyToOutputDirectory> … … 218 227 </None> 219 228 <None Include="MonoRail.Tests.Views\Home\ComponentRenderViewUsesGlobalSpark.spark"> 229 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 230 </None> 231 <None Include="MonoRail.Tests.Views\Home\NullBehaviourConfiguredToLenient.spark"> 220 232 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 221 233 </None> trunk/src/Castle.MonoRail.Views.Spark.Tests/ModelDictionaryTests.cs
r213 r257 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using NUnit.Framework; 1 // Copyright 2008 Louis DeJardin - http://whereslou.com 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 6 15 7 16 namespace Castle.MonoRail.Views.Spark.Tests 8 17 { 18 using System.Collections.Generic; 19 using NUnit.Framework; 20 9 21 [TestFixture] 10 22 public class ModelDictionaryTests trunk/src/Castle.MonoRail.Views.Spark.Tests/PrecompileInstallerTests.cs
r187 r257 13 13 // limitations under the License. 14 14 // 15 using System;16 using System.Collections;17 using System.Collections.Generic;18 using System.Configuration.Install;19 using System.IO;20 using System.Linq;21 using System.Reflection;22 using System.Text;23 using Castle.MonoRail.Views.Spark.Install;24 using Castle.MonoRail.Views.Spark.Tests.Stubs;25 using NUnit.Framework;26 15 27 16 namespace Castle.MonoRail.Views.Spark.Tests 28 17 { 18 using System; 19 using System.Collections; 20 using System.Configuration.Install; 21 using System.IO; 22 using System.Linq; 23 using System.Reflection; 24 using Castle.MonoRail.Views.Spark.Install; 25 using Castle.MonoRail.Views.Spark.Tests.Stubs; 26 using NUnit.Framework; 27 29 28 [TestFixture] 30 29 public class PrecompileInstallerTests trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkBatchCompilerTester.cs
r187 r257 13 13 // limitations under the License. 14 14 // 15 using Castle.MonoRail.Framework;16 using Castle.MonoRail.Framework.Helpers;17 using Castle.MonoRail.Framework.Test;18 using Castle.MonoRail.Views.Spark;19 using Castle.MonoRail.Views.Spark.Tests.Stubs;20 using NUnit.Framework;21 using Spark;22 using System.Linq;23 using Spark.FileSystem;24 15 25 16 namespace Castle.MonoRail.Views.Spark.Tests 26 17 { 18 using System.Linq; 19 using NUnit.Framework; 20 21 using Castle.MonoRail.Framework; 22 using Castle.MonoRail.Framework.Helpers; 23 using Castle.MonoRail.Framework.Test; 24 using Castle.MonoRail.Views.Spark.Tests.Stubs; 25 26 using global::Spark; 27 using global::Spark.FileSystem; 28 27 29 [TestFixture] 28 30 public class SparkBatchCompilerTester trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkViewFactoryTests.cs
r229 r257 13 13 // limitations under the License. 14 14 // 15 using Castle.MonoRail.Framework.Providers;16 17 15 namespace Castle.MonoRail.Views.Spark.Tests 18 16 { 19 using System;20 using System.Collections;21 using System.Collections.Generic;22 using System.Collections.Specialized;23 17 using System.IO; 24 18 25 using Castle.Core.Logging; 19 26 20 using Castle.MonoRail.Framework; 27 21 using Castle.MonoRail.Framework.Helpers; 28 using Castle.MonoRail.Framework.Routing;29 22 using Castle.MonoRail.Framework.Services; 30 using Castle.MonoRail.Framework.Test;31 32 23 using NUnit.Framework; 33 using Rhino.Mocks;34 24 using global::Spark; 35 25 26 36 27 [TestFixture] 37 public class SparkViewFactoryTests 38 {39 private MockRepository mocks; 40 private IEngineContext engineContext; 41 private IResponse response;42 private IServerUtility server;28 public class SparkViewFactoryTests : SparkViewFactoryTestsBase 29 { 30 protected override void Configure() 31 { 32 factory = new SparkViewFactory(); 33 factory.Service(serviceProvider); 43 34 44 private IController controller; 45 private IControllerContext controllerContext; 35 manager = new DefaultViewEngineManager(); 36 manager.Service(serviceProvider); 37 serviceProvider.ViewEngineManager = manager; 38 serviceProvider.AddService(typeof(IViewEngineManager), manager); 46 39 47 private IDictionary propertyBag; 40 manager.RegisterEngineForExtesionLookup(factory); 41 manager.RegisterEngineForView(factory); 42 } 48 43 49 private StringWriter output; 50 private DefaultViewEngineManager manager; 51 private IRoutingEngine routingEngine; 52 private SparkViewFactory factory; 53 private StubMonoRailServices serviceProvider; 54 55 [SetUp] 56 public void Init() 57 { 58 mocks = new MockRepository(); 59 serviceProvider = new StubMonoRailServices(); 60 61 var viewSourceLoader = new FileAssemblyViewSourceLoader("MonoRail.Tests.Views"); 62 viewSourceLoader.Service(this.serviceProvider); 63 serviceProvider.ViewSourceLoader = viewSourceLoader; 64 serviceProvider.AddService(typeof(IViewSourceLoader), viewSourceLoader); 65 66 factory = new SparkViewFactory(); 67 factory.Service(serviceProvider); 68 69 manager = new DefaultViewEngineManager(); 70 manager.Service(serviceProvider); 71 serviceProvider.ViewEngineManager = manager; 72 serviceProvider.AddService(typeof(IViewEngineManager), manager); 73 74 manager.RegisterEngineForExtesionLookup(factory); 75 manager.RegisterEngineForView(factory); 76 77 78 controllerContext = new ControllerContext(); 79 propertyBag = controllerContext.PropertyBag; 80 81 controllerContext.LayoutNames = new []{"default"}; 82 output = new StringWriter(); 83 84 server = new StubServerUtility(); 85 routingEngine = mocks.CreateMock<IRoutingEngine>(); 86 var urlBuilder = new DefaultUrlBuilder(server, routingEngine); 87 serviceProvider.UrlBuilder = urlBuilder; 88 serviceProvider.AddService(typeof(IUrlBuilder), urlBuilder); 89 90 InitUrlInfo("", "home", "index"); 91 92 response = engineContext.Response; 93 } 94 95 96 void InitUrlInfo(string areaName, string controllerName, string actionName) 97 { 98 var urlInfo = new UrlInfo(areaName, controllerName, actionName, "/", "castle"); 99 100 engineContext = new StubEngineContext(); 101 engineContext.AddService(typeof(IUrlBuilder), serviceProvider.UrlBuilder); 102 engineContext.CurrentController = controller; 103 engineContext.CurrentControllerContext = controllerContext; 104 engineContext.Services.ViewEngineManager = serviceProvider.ViewEngineManager; 105 output = (StringWriter) engineContext.Response.Output; 106 107 var routeMatch = new RouteMatch(); 108 controllerContext.RouteMatch = routeMatch; 109 } 110 111 static void ContainsInOrder(string content, params string[] values) 112 { 113 int index = 0; 114 foreach (string value in values) 115 { 116 int nextIndex = content.IndexOf(value, index); 117 Assert.GreaterOrEqual(nextIndex, 0, string.Format("Looking for {0}", value)); 118 index = nextIndex + value.Length; 119 } 120 } 121 122 [Test] 44 [Test] 123 45 public void ExtensionIsSpark() 124 46 { … … 186 108 } 187 109 110 [Test] 111 public void NullBehaviourConfiguredToLenient() 112 { 113 mocks.ReplayAll(); 114 manager.Process("Home\\NullBehaviourConfiguredToLenient", output, engineContext, controller, controllerContext); 115 var content = output.ToString(); 116 Assert.IsFalse(content.Contains("default")); 117 118 ContainsInOrder(content, 119 "<p>name kaboom *${user.Name}*</p>", 120 "<p>name silently **</p>", 121 "<p>name fixed *fred*</p>"); 122 } 123 188 124 [Test] 189 125 public void TerseHtmlEncode() trunk/src/CommonAssemblyInfo.cs
r256 r257 6 6 // <auto-generated> 7 7 // This code was generated by a tool. 8 // Runtime Version:2.0.50727. 14348 // Runtime Version:2.0.50727.3506 9 9 // 10 10 // Changes to this file may cause incorrect behavior and will be lost if trunk/src/Spark.Python
- Property svn:ignore changed from
bin
obj
to
bin
obj
_ReSharper.TempSolution
- Property svn:ignore changed from
trunk/src/Spark.Python/ScriptingLanguageFactory.cs
r253 r257 52 52 viewCompiler.Descriptor = descriptor; 53 53 viewCompiler.Debug = engine.Settings.Debug; 54 viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; 54 55 viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 55 56 viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; trunk/src/Spark.Ruby/RubyLanguageFactory.cs
r247 r257 53 53 viewCompiler.Descriptor = descriptor; 54 54 viewCompiler.Debug = engine.Settings.Debug; 55 viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 55 viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; 56 viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 56 57 viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; 57 58 return viewCompiler; trunk/src/Spark.Tests/App.config
r89 r257 5 5 </configSections> 6 6 <spark> 7 <compilation debug="true" >7 <compilation debug="true" nullBehaviour="Strict"> 8 8 <assemblies> 9 9 <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> trunk/src/Spark.Tests/SparkSectionHandlerTester.cs
r187 r257 39 39 var config = (SparkSectionHandler)ConfigurationManager.GetSection("spark"); 40 40 Assert.IsTrue(config.Compilation.Debug); 41 Assert.AreEqual(NullBehaviour.Strict, config.Compilation.NullBehaviour); 41 42 Assert.AreEqual(1, config.Compilation.Assemblies.Count); 42 43 Assert.AreEqual(typeof(StubSparkView).FullName, config.Pages.PageBaseType); … … 65 66 var settings = new SparkSettings() 66 67 .SetDebug(true) 68 .SetNullBehaviour(NullBehaviour.Lenient) 67 69 .AddNamespace("System") 68 70 .AddNamespace("System.Collections.Generic") … … 72 74 73 75 Assert.IsTrue(settings.Debug); 76 Assert.AreEqual(NullBehaviour.Lenient, settings.NullBehaviour); 74 77 Assert.AreEqual(3, settings.UseNamespaces.Count()); 75 78 Assert.AreEqual(2, settings.UseAssemblies.Count()); trunk/src/Spark.Tests/SparkViewFactoryTester.cs
r256 r257 641 641 642 642 [Test] 643 public void DynamicAttributes()643 public void DynamicAttributes() 644 644 { 645 645 mocks.ReplayAll(); trunk/src/Spark/Compiler/CSharp/ChunkVisitors/GeneratedCodeVisitor.cs
r256 r257 13 13 // limitations under the License. 14 14 // 15 using System.Collections;16 15 using System.Collections.Generic; 17 using System.IO;18 16 using System.Linq; 19 17 using System.Text; … … 25 23 { 26 24 private readonly StringBuilder _source; 27 28 public GeneratedCodeVisitor(StringBuilder output, Dictionary<string, object> globalSymbols) 29 { 25 private readonly NullBehaviour _nullBehaviour; 26 27 public GeneratedCodeVisitor(StringBuilder output, Dictionary<string, object> globalSymbols, NullBehaviour nullBehaviour) 28 { 29 _nullBehaviour = nullBehaviour; 30 30 _source = output; 31 31 32 _scope = new Scope(new Scope(null) { Variables = globalSymbols});32 _scope = new Scope(new Scope(null) { Variables = globalSymbols }); 33 33 } 34 34 … … 66 66 Prior = prior; 67 67 } 68 public Dictionary<string, object> Variables { get; set; }68 public Dictionary<string, object> Variables { get; set; } 69 69 public Scope Prior { get; set; } 70 70 } … … 87 87 { 88 88 var scan = _scope; 89 while (scan != null)89 while (scan != null) 90 90 { 91 91 if (scan.Variables.ContainsKey(name)) … … 114 114 CodeDefault(); 115 115 AppendIndent().AppendLine("}"); 116 AppendIndent().AppendLine("catch(System.NullReferenceException )");116 AppendIndent().AppendLine("catch(System.NullReferenceException ex)"); 117 117 AppendIndent().AppendLine("{"); 118 if (!chunk.SilentNulls) 119 { 120 AppendIndent().Append(" Output.Write(\"${") 118 Indent += 4; 119 if (_nullBehaviour == NullBehaviour.Lenient) 120 { 121 if (!chunk.SilentNulls) 122 { 123 AppendIndent().Append("Output.Write(\"${") 124 .Append(EscapeStringContents(chunk.Code)) 125 .AppendLine("}\");"); 126 } 127 } 128 else 129 { 130 AppendIndent().Append("throw new System.ArgumentNullException(\"${") 121 131 .Append(EscapeStringContents(chunk.Code)) 122 .AppendLine("}\");"); 123 } 132 .AppendLine("}\", ex);"); 133 } 134 Indent -= 4; 124 135 AppendIndent().AppendLine("}"); 125 136 } … … 299 310 protected override void Visit(UseImportChunk chunk) 300 311 { 301 312 302 313 } 303 314 trunk/src/Spark/Compiler/CSharp/ChunkVisitors/GlobalMembersVisitor.cs
r191 r257 24 24 private readonly StringBuilder _source; 25 25 private readonly Dictionary<string, object> _globalSymbols; 26 readonly Dictionary<string, string> _viewDataAdded = new Dictionary<string, string>(); 26 private readonly NullBehaviour _nullBehaviour; 27 readonly Dictionary<string, string> _viewDataAdded = new Dictionary<string, string>(); 27 28 readonly Dictionary<string, GlobalVariableChunk> _globalAdded = new Dictionary<string, GlobalVariableChunk>(); 28 29 private int _indent = 4; 29 30 30 public GlobalMembersVisitor(StringBuilder output, Dictionary<string, object> globalSymbols)31 public GlobalMembersVisitor(StringBuilder output, Dictionary<string, object> globalSymbols, NullBehaviour nullBehaviour) 31 32 { 32 33 _source = output; 33 34 _globalSymbols = globalSymbols; 35 _nullBehaviour = nullBehaviour; 34 36 } 35 37 … … 171 173 172 174 CodeDefault(); 173 var generator = new GeneratedCodeVisitor(_source, null ) { Indent = 12 };175 var generator = new GeneratedCodeVisitor(_source, null, _nullBehaviour) { Indent = 12 }; 174 176 generator.Accept(chunk.Body); 175 177 trunk/src/Spark/Compiler/CSharp/DefaultViewCompiler.cs
r225 r257 40 40 var usingGenerator = new UsingNamespaceVisitor(source); 41 41 var baseClassGenerator = new BaseClassVisitor { BaseClass = BaseClass }; 42 var globalsGenerator = new GlobalMembersVisitor(source, globalSymbols );42 var globalsGenerator = new GlobalMembersVisitor(source, globalSymbols, NullBehaviour); 43 43 44 44 … … 116 116 source.AppendLine(string.Format(" public void RenderViewLevel{0}()", renderLevel)); 117 117 source.AppendLine(" {"); 118 var viewGenerator = new GeneratedCodeVisitor(source, globalSymbols ) { Indent = 8 };118 var viewGenerator = new GeneratedCodeVisitor(source, globalSymbols, NullBehaviour) { Indent = 8 }; 119 119 viewGenerator.Accept(viewTemplate); 120 120 source.AppendLine(" }"); trunk/src/Spark/Compiler/ViewCompiler.cs
r187 r257 38 38 39 39 public bool Debug { get; set; } 40 public IEnumerable<string> UseNamespaces { get; set; } 40 public NullBehaviour NullBehaviour { get; set; } 41 public IEnumerable<string> UseNamespaces { get; set; } 41 42 public IEnumerable<string> UseAssemblies { get; set; } 42 43 trunk/src/Spark/Configuration/CompilationElement.cs
r187 r257 13 13 // limitations under the License. 14 14 // 15 using System; 15 16 using System.Configuration; 16 17 … … 26 27 } 27 28 29 [ConfigurationProperty("nullBehaviour", DefaultValue = NullBehaviour.Lenient)] 30 public NullBehaviour NullBehaviour 31 { 32 get { return (NullBehaviour)this["nullBehaviour"]; } 33 set { this["nullBehaviour"] = value; } 34 } 35 28 36 [ConfigurationProperty("assemblies")] 29 37 [ConfigurationCollection(typeof(AssemblyElementCollection))] trunk/src/Spark/Configuration/SparkSectionHandler.cs
r187 r257 84 84 } 85 85 86 NullBehaviour ISparkSettings.NullBehaviour 87 { 88 get { return Compilation.NullBehaviour; } 89 } 90 86 91 string ISparkSettings.Prefix 87 92 { trunk/src/Spark/DefaultLanguageFactory.cs
r234 r257 30 30 viewCompiler.Descriptor = descriptor; 31 31 viewCompiler.Debug = engine.Settings.Debug; 32 viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; 32 33 viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 33 34 viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; trunk/src/Spark/ISparkSettings.cs
r187 r257 19 19 namespace Spark 20 20 { 21 public enum NullBehaviour 22 { 23 /// <summary>Catch NullReferenceExceptions, and either render the literal expression, or render nothing, respectively, when ${expression} or $!{expression} syntax is used</summary> 24 /// <remarks><c>Lenient</c> is the default setting.</remarks> 25 Lenient, 26 /// <summary>Do not wrap expressions in try/catch blocks. Intended for fail-fast in development environment.</summary> 27 Strict 28 } 29 21 30 public interface ISparkSettings 22 31 { 23 32 bool Debug { get; } 33 NullBehaviour NullBehaviour { get; } 24 34 string Prefix { get; } 25 35 string PageBaseType { get; set; } 36 26 37 IEnumerable<string> UseNamespaces { get; } 27 38 IEnumerable<string> UseAssemblies { get; } trunk/src/Spark/SparkSettings.cs
r187 r257 15 15 using System; 16 16 using System.Collections.Generic; 17 using System.Linq;18 17 using System.Reflection; 19 using System.Text;20 18 using Spark.FileSystem; 21 19 … … 30 28 _resourceMappings = new List<ResourceMapping>(); 31 29 _viewFolders = new List<IViewFolderSettings>(); 30 NullBehaviour = NullBehaviour.Lenient; 32 31 } 33 32 34 33 public bool Debug { get; set; } 35 public string Prefix { get; set; } 34 public NullBehaviour NullBehaviour { get; set; } 35 public string Prefix { get; set; } 36 36 public string PageBaseType { get; set; } 37 37 … … 65 65 return this; 66 66 } 67 68 public SparkSettings SetNullBehaviour(NullBehaviour nullBehaviour) 69 { 70 NullBehaviour = nullBehaviour; 71 return this; 72 } 67 73 68 74 public SparkSettings SetPageBaseType(string typeName)
