visionmedia/express — pull request #1107 by unicyclon (2012-04-25 17:50:36+00:00)
Title: Made the signature of View.lookup async, and added option to make the lookup function being overridable

This fixes issue [#1089](https://github.com/visionmedia/express/issues/1089).

**Summary of changes:**

* Created a new `lookupView` function in `utils`, which behaves pretty much like the current `View.lookup` method, except it is asynchronous.

* Added a new option `view lookup`, which can be used to replace the `utils.lookupView` with a custom function. It expects to be passed a function with the same exact signature as `utils.lookupView`.

* Updated `App.render`, which now passes the lookup function to use to the `View`, in the already-existing options object. Additionally, responsibility to send error message when a view does not exist has been moved to the `View.lookup` method.

* Updated `View.lookup`, whose only responsibility is to call the actual view lookup function passed by `App.render`, and throw an error if not found.

* Updated `View.render`, which now is responsible to call `View.lookup`.