forked from soveran/cuba
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not update template mtime when there is an error reloading templat…
…es in the render plugin Previously, if there was an mtime change for the related file, Roda would update the stored mtime, then try to reload the file. However, if the file was invalid (e.g. SyntaxError), then in compiled templates mode, the compiled template method would not be updated, so it still have the previous template code associated with it. If no further changes were made to the template, future template renders would return the result of the previous template before the reload, resulting in unexpected behavior until the template was fixed. Replace TemplateMtimeWrapper#modified with TemplateMtimeWrapper#if_modified, which takes a block, and yields if it detects a modification. The mtime for the object is not updated unless the block returns normally. Put the template reloading code into the block. For non-compiled templates, attempt to render the template inside the if_modified block, and only update the mtime if the rendering succeeds. This change can result in additional work if the template has not been fixed after it was broken, since every request after it is broken will attempt to reload it. However, template reloading is generally only done in development mode, and without attempting to reload, the template would raise an exception just as in previous requests. While here, remove the unnecessary template argument to compiled_method_lambda, since it is only ever set to self.
- Loading branch information
1 parent
f6cc4d9
commit cd7caf3
Showing
3 changed files
with
41 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters