Merge pull request #388 from nbaum/master

Don't leave @default_layout set to false if rendering a template fails
This commit is contained in:
Konstantin Haase 2011-10-14 08:42:39 -07:00
commit 2a9e7b60df
1 changed files with 8 additions and 5 deletions

View File

@ -619,11 +619,14 @@ module Sinatra
scope = options.delete(:scope) || self
# compile and render template
layout_was = @default_layout
@default_layout = false
template = compile_template(engine, data, options, views)
output = template.render(scope, locals, &block)
@default_layout = layout_was
begin
layout_was = @default_layout
@default_layout = false
template = compile_template(engine, data, options, views)
output = template.render(scope, locals, &block)
ensure
@default_layout = layout_was
end
# render layout
if layout