Webware for Python 0.8
AutoReload – A new setting in AppServer.config, 'AutoReload' enables the AutoReloadingAppServer module. This module is designed to notice changes to source files, including servlets, PSP's templates, or changes to the Webware source files, and reload the server as necessary to pick up the changes.
This uses the python FAM (fam = File Alteration Monitor) if present. Otherwise it resorts to polling. The polling interval can be set with the AutoReloadPollInterval setting which defaults to 1 second.
Updates to includeURL(), forward(), and callMethodOfServlet()
New methods in HTTPRequest:
siteRoot() – Returns the URL path components necessary to get back home from the current location.
You can use this as a prefix to a URL that you know is based off the home location. Any time you are in a servlet that may have been forwarded to from another servlet at a different level, you should prefix your URL's with this. That is, if servlet "Foo/Bar" forwards to "Qux", then the qux servlet should use siteRoot() to construct all links to avoid broken links. This works properly because this method computes the path based on the original servlet, not the location of the servlet that you have forwarded to.
Enhancements to PickleRPCServlet (and the client library MiscUtils.PickleRPC):
New method Page.endResponse() which does the following:
This is mainly useful if you want to call self.forward() or self.response().sendRedirect() within a deeply nested hierarchy of method calls and skip the rest of your processing without having to contort your code. It is implemented internally by raising an EndResponse exception which is silently caught at the appropriate place within Application.
Typical usage is:
if some_conditions_are_satisfied(): self.forward('some/other/servlet') # or self.response().sendRedirect('somewhere') self.endResponse() # continue processing...
Any Python module can now get a reference to the app server singleton via:
from WebKit.AppServer import globalAppServer