ipython/ipython — pull request #6003 by stevenmanton (2014-06-17 19:32:03+00:00)
Title: Set kernel_id before checking websocket

If websocket attempt fails and cross origin attempt is detected, a HTTPError(404) error is raised. However, in the process of closing connections because of this 404 error, an unhandled Attribute exception (kernel_id not an attribute) is raised. Setting the kernel_id first avoids this.