WebKit version 0.9 released on 11/13/05
It has taken much longer than usual to finish this release, and it is impossible to track and list every change. So the following will mention only a few of the many changes, improvements and bugfixes that have been made.
-u
(unbuffered output) and -O
(optimize)
parameters and passes them to Python. These parameters must precede
any other parameters. Other parameters will be passed to
ThreadedAppServer
normally.ClassName.SettingName=value
, e.g.
AppServer.AdapterPort=8087
.-d
allowing to point the default context to a location not
inside the working directory, so you can keep your code completely separate
from the working directory. It also accepts -l
options to
add multiple application library dirs to the Python path, and options to
set the ownership of the working directory files. To see all options,
run the command without any parameters.EnterDebuggerOnException
option to
Application.config. If True, and if the
AppServer is running from an interactive terminal, an uncaught exception
will cause the AppServer to enter the debugger, allowing the developer to
call functions, investigate variables, etc. See Python debugger (pdb) docs
for more information. You will certainly want to turn this off when
deploying the site. Defaults to False (off).UseCookieSessions
that defaults to True. If set to False,
then a session cookie will never be sent in the response. Use this along
with UseAutomaticPathSessions
to only use path
sessions and never use cookie sessions.HTTPRequest.setSessionId()
method which allows
the use of session IDs that are sent via means other than cookies or
URL parameters (an example would be via an XML-RPC parameter).
See the docstring for more details.DebugAppServer
, a single-threaded app server
that makes it possible to debug servlets using a standard Python
debugger. Tested on Windows only, using both PythonWin and JEdit with
the JPyDbg plugin. See
WebKit/DebugAppServer.py for details.IncludeEditLink
in
Application.config, an [edit]
link will be put next to each line in tracebacks. That link will point
to a file of type application/x-webkit-edit-file, which you
should configure your browser to run with
Webware/bin/editfile.py.
If you configure editfile.py correctly,
then it will automatically open the respective Python module with your
favorite Python editor and put the cursor on the erroneous line.WebKit.Object
now inherits Python's object.
This affects all other classes for which Super() should now work.mimetypes.guess_type()
cannot return something meaningful) are now served up with a mime type of
application/octet-stream instead of text/html.XMLRPCServlet
now allows xmlrpclib.Fault
exceptions to be passed through unmolested.Page
has been refactored into HTTPContent
and Page
. HTTPContent
can be used as a base
class for servlets which generate non-HTML content. As Page
inherits from HTTPContent
(which inherits from
HTTPServlet
), Page
still contains all the
methods it previously did, and this change should not require any changes
to end-user code.XMLRPCServlets
are now allowed to return None as part of
their marshaled response. This improves usability in an all-Python
environment at the possible cost of compatibility problems
with non-Python clients. To revert to the old behavior, where an
attempt to respond with None
caused an exception, add
allow_none = False
to your XMLRPCServlet
-derived
servlets at class level (adding self.allow_none = False
in the __init__
should also work).transaction()
method to RPCServlet
so that there's a way for a method to get the transaction object if
needed.Previously, attempting to start an already-running AppServer would fail when it couldn't grab the socket to listen on, but it would have already overwritten the pid file.
Now pid file handling is much improved:
PidFile
setting in
AppServer.config. By default,
the pid is written to appserverpid.txt
in the working directory (or WebKit path if you're not using a working
directory).None
in AppServer.config.
This seems to be a good idea on Windows because Windows often
reuses the same pid right away, so if the appserver crashes, and it
tries to restart and it happens to reuse the same pid, the restart
will fail.The shutdown handling has been improved. Sending SIGHUP now results in exiting with exit code 3 which is used for reloading via the AppServer script.
Port
setting in
AppServer.config has been deprecated in
favor of the new AdapterPort
setting. The Port
setting in your config file will still be honored, but you are encouraged
to update your AppServer.config as the
Port
setting will be removed in the future.OldStyleActions
and re-implemented support of the
methodNameForAction()
transformation. Note that "old style"
actions took an additional transaction
parameter, but
otherwise the action handling is now downward compatible.WebKit.Page
resp. WebKit.HTTPContent
,
removed both the internal method _actionSet()
and the internal
dictionary _actionDict
which cached the list of actions
for the servlet. This was redundant code, and its removal allows a servlet
to use dynamic actions (i.e. to make the action list dependent on the
permissions of the logged-in user).The semantics for the awake-respond-sleep cycle have changed so that Servlet.sleep() is always called, even when an unhandled exception occurs in Servlet.awake() or Servlet.respond(). Servlet.sleep() is called even when Page.endResponse() or Page.sendRedirectAndEnd() have been called to end servlet processing prematurely. This behavior differs from previous versions, in which sleep() was called only if awake() succeeded.
The intent of this change is to guarantee servlets the chance to free resources, without having to be prepared to catch all possible exceptions within awake() to do so.
The programmer should ensure that sleep does not attempt to free resources which were never allocated, as sleep() may be called even when awake() did not succeed.
def awake(...): initialize resource A initialize resource B def sleep(...): if resource B was initialized: finalize resource B if resource A was initialized: finalize resource A