Error and Exception Handling

CherryPy tries hard to help the developer see a web application as close as a rich application. This means that from your page handler you may raise a Python error or exception as in any other Python application. CherryPy will catch those and transform them into HTTP messages depending on the type of errors. Note that when an exception is raised and not caught by any other part of the application, CherryPy will return the corresponding HTTP 500 error code. For example, the following example...

Hook into Cherry Pys Core Engine

Call Handling Process

One of the most powerful aspects of CherryPy is how its core lets you modify its normal behavior with a very fine granularity. Indeed, CherryPy offers a mechanism called hooking to customize the core engine. A hook is an entry point for Python callables to be applied at specific points during the request processing. CherryPy provides the following entry points Called at the beginning of the process. Called before CherryPy tries to read the request body. It allows a tool to inform CherryPy...

Application under Test

Before we explain how Selenium components work, we must introduce an application example. This application will simply provide one web page with two links. One of them will replace the current page with a new one. The second link will fetch data using Ajax. We use this example rather than our photoblog application for the sake of simplicity. The code of the application is as follows _header lt html gt lt head gt lt title gt Selenium test lt title gt lt head gt lt script type application...

Authentication using Digest or Basic Schemes

The open method of XMLHttpRequest can take username and password parameters to be sent along with the request. The authentication schemes supported by XMLHttpRequest are defined in RFC 2617, namely basic and digest. These two schemes are as follows Basic scheme The basic scheme is simply the transfer of the username and password encoded using the base64 algorithm. The issue with this is that, if a third-party fetches the encoded value, nothing can be done to prevent it from being decoded. This...