%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2001 by Object Craft P/L, Melbourne, Australia.
% LICENCE - see LICENCE file distributed with this software for details.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Summary of Changes\label{changes}}

This chapter describes the changes made to Albatross between releases.

\section{Release 1.11\label{rel-1.11}}

This section describes the changes in release 1.11 of Albatross that
were made since release 1.10.

\subsection{Functional Changes\label{rel-1.11-func}}

\subsubsection{\texttt{<al-select>/<al-input>} consistency\label{rel-1.11-alselectconsistency}}

\texttt{<al-select>} handling of \texttt{name}, \texttt{expr},
\texttt{valueexpr} and \texttt{value} attributes has been made consistent
with that of \texttt{<al-input}.

\subsubsection{\texttt{absolute_base_url} method\label{rel-1.11-absbaseurl}}

New method \method{absolute_base_url()} has been added to the
\class{AppContext}.

\subsubsection{\texttt{al-httpd} enhancements\label{rel-1.11-httpd}}

Matt Goodall has continued to improve the capabilities of the
\texttt{al-httpd} program and \module{httpdapp.py} so that it is now
possible to run all of the CGI bassed sample applications.

You can now initialise the \code{static_resources} from the command
line.  For example, the tree samples can be executed to serve up their
images like this:

\begin{verbatim}
$ cd samples/tree2
$ al-httpd tree.app 8080 /alsamp/images ../images/
\end{verbatim}

\subsubsection{XHTML fixes\label{rel-1.11-xhtml}}

The \texttt{<al-input>} and \texttt{<al-img>} tags now output XHTML
compliant end tags.

\subsection{Bug Fixes\label{rel-1.11-bug}}

\subsubsection{\texttt{mod_python} support\label{rel-1.11-modpython}}

Greg Bond fixed a \module{cgiapp} field handling incompatibility with
\texttt{mod_python} 3.

\subsubsection{\texttt{get_servername()} support\label{rel-1.11-servername}}

The \method{get_servername()} method of the \module{cgiapp} and
\module{fcgiapp} \class{Request} classes now use the
\texttt{HTTP_HOST} environment variable rather than
\texttt{SERVER_NAME}.

\subsubsection{Multiple cookies\label{rel-1.11-cookie}}

All session cookies now include a path attribute.  This prevents
multiple redundant cookies being set for all URI paths in an
application.

\section{Release 1.10\label{rel-1.10}}

This section describes the changes in release 1.10 of Albatross that
were made since release 1.01.

\subsection{Functional Changes\label{rel-1.10-func}}

\subsubsection{FastCGI support\label{rel-1.10-fastcgi}}

Matt Goodall developed support for deployment of applications via
FastCGI.  FastCGI applications import their \class{Request} class from
\module{albatross.fcgiapp}.

\subsubsection{Standalone BaseHTTPServer support\label{rel-1.10-standalone}}

Matt Goodall developed support for standalone deployment of
applications via the standard Python \module{BaseHTTPServer} module.
The \texttt{al-httpd} program can be used to deploy a CGI application
as a standalone \module{BaseHTTPServer} server.

\subsubsection{Exception Classes\label{rel-1.10-exc}}

All Albatross exceptions have been redefined to indicate the source of
the error; user (\exception{UserError}), programmer
(\exception{ApplicationError}), or Albatross itself
(\exception{InternalError}).  The \exception{ServerError} exception
reports problems related to the session server, 
\exception{SecurityError} reports either a programmer error, or a user
attempt to access restricted values in the execution context, and
\exception{TemplateLoadError} reports failures to load templates.

All of the exceptions inherit from \exception{AlbatrossError}.

The \module{albatross.common} module defines the exceptions.

\subsubsection{Response Header Management\label{rel-1.10-headers}}

All response header management has been moved to the
\class{ResponseMixin} class.  The \class{AppContext} class now
inherits from \class{ResponseMixin}.  The \class{Request} class no
longer tracks whether or not headers have been sent.

\class{ResponseMixin} provides the ability to set, get, delete, and
send headers.  Headers are automatically sent when the application
sends any content to the browser.

The \method{write_headers()} method has been deleted from the
following classes; \class{SimpleAppContext},
\class{SessionAppContext}, \class{SessionServerContextMixin},
\class{SessionFileContextMixin}, \class{SessionFileAppContext}.

For \class{SessionServerContextMixin} and
\class{SessionFileContextMixin} the \texttt{Set-Cookie} header is set
when session is created or loaded.

\subsubsection{HTTP Response Codes\label{rel-1.10-response}}

The \method{Application.run()} method no longer unconditionally
returns an HTTP response code of \texttt{200}.  The returned response
code is retrieved from the \class{Request.status()} method.  You can
call the \method{Request.set_status()} method to override the default
HTTP response code of \code{200}.

\subsubsection{File Uploading\label{rel-1.10-upload}}

The \texttt{<al-input>} tag now supports \texttt{type="file"} input
tags.  When you use file input tags the enclosing \texttt{<al-form>}
tag automatically adds the \texttt{enctype="multipart/form-data"}
attribute to the generated \texttt{<form>} tag.

The \module{albatross.cgiapp} and \module{albatross.apacheapp} modules
define a \class{FileField} class which provides access to uploaded
files.  During request merging the \method{Request.field_file()}
method returns instances of \class{FileField} for uploaded files.

\subsubsection{Session Changes\label{rel-1.10-session}}

The \method{Application.run()} method now saves the session before
flushing the response to the browser.  This allows applications to
support dynamically generated images.

The \method{SessionBase.add_session_vars()} method now raises an
\exception{ApplicationError} exception if you attempt to add variables
to the session which do not exist in the local namespace.

The \method{SessionBase.default_session_var()} method allows you to
add a variable to the session and place it in the local namespace at
the same time.

Session saving previously silently removed session values which could
not be pickled.  Now unpickleable values are reported via an
\exception{ApplicationError} exception.

Errors handling and reporting during session loading has been
improved.

\subsubsection{Exception Formatting and Handling\label{rel-1.10-excfmt}}

The exception formatting in \method{Application.handle_exception()}
has been moved into the \method{format_exception()} method.
Applications can perform their own exception formatting and/or send
formatted exceptions to locations other than the browser.

\subsubsection{Unicode\label{rel-1.10-unicode}}

The \method{ExecuteMixin.write_content()} method now converts unicode
to UTF-8.

\subsubsection{Execution Context Available to Template Expressions\label{rel-1.10-ctx}}

During \method{NamespaceMixin.eval_expr()} the execution context is
temporary placed into the local namespace as the variable
\var{__ctx__}.

\subsubsection{Request Merging\label{rel-1.10-merging}}

\method{NamespaceMixin.set_value()} ignores attempts to set Albatross
iterators that are not present in the namespace.

\method{NamespaceMixin.set_value()} produces a nice syntax error like
report when an illegal field name is used.

\subsubsection{Locating Globals for Template Expressions\label{rel-1.10-globals}}

The \function{_caller_globals()} function has been changed to use the
name of a function rather a stack frame count.  This is used by the
methods \method{AppContext.run_template()},
\method{AppContext.run_template_once()},
\method{RandomPageModuleMixin.display_response()}, and
\method{SimpleContext.__init__()} to locate the module whose globals
will be used as the global namespace for evaluating template
expressions.

\subsubsection{Tree Handling\label{rel-1.10-tree}}

The \texttt{<al-tree>} tag now has a \texttt{single} attribute which
enables the single select mode.  In single select mode, selecting a
node automatically deselects any previously selected node.

The \texttt{<al-input>} tag now supports the \texttt{treefold="expr"},
\texttt{treeselect="expr"}, and \texttt{treeellipsis="expr"}
attributes.  The expression specifies a tree node that is used to
construct a tree iterator input value.

The following methods have been added to the \class{LazyTreeIterator}
class; \method{load_children()}, \method{is_selected()},
\method{select_alias()}, \method{open_alias()}.

\subsubsection{Lookup Evaluation\label{rel-1.10-lookup}}

The \texttt{<al-lookup>} tag now registers the lookup during template
parsing rather than during evaluation.  This allows template code to
make use of lookups that are defined later in the same file.  The item
dictionary is created the first time that the lookup is used rather
than when the template is interpreted.

\subsubsection{Macro Argument Evaluation\label{rel-1.10-macro}}

Macro arguments are now evaluated when they are referenced rather than
before they are passed to a macro.

This removes a limitation where you could not define macros including
\texttt{<al-form>} tags that retrieved \texttt{<al-input>} tags from
their arguments.  Previously the \texttt{<al-input>} tags passed as
macro arguments would have been evaluated outside of the context of
the form defined in the macro.  This effectively made the input tags
invisible to the form recorder.

\subsubsection{\texttt{<select>/<option>} formatting\label{rel-1.10-select}}

The \texttt{<al-option>} and \texttt{<al-select>} tags always write
\texttt{</option>} close tags.

\subsubsection{\texttt{noescape} tag attribute\label{rel-1.10-noescape}}

The \texttt{noescape} attribute has been added to the
\texttt{<al-input>}, \texttt{<al-img>}, \texttt{<al-select>}, and
\texttt{<al-textarea>} tags.

\subsubsection{Documentation\label{rel-1.10-doc}}

The templates reference documentation has been completely restructured
to improve clarity.  All attributes of each tag have been documented.

\subsection{Bug Fixes\label{rel-1.10-bug}}

\subsubsection{Lingering Content Trap\label{rel-1.10-content}}

In some circumstances exceptions would leave a content trap in place
that prevented an error report from being written to the browser.

\subsubsection{Session Loading\label{rel-1.10-sesload}}

More exceptions are trapped by the session unpickling code to make
error handling more robust.

\subsubsection{Random Page Module Loading\label{rel-1.10-pageload}}

Fixed a bug where an import error inside a page module loaded by the
\class{RandomPageModuleMixin} was being handled as if page module
could not be located.

\subsubsection{Session Id Cookie Handling\label{rel-1.10-sescookie}}

Fixed cookie handling which previously could not cope with missing
session id when the cookie was present.

\subsubsection{\texttt{<al-input>} tag\label{rel-1.10-input}}

Fixed bug in checkbox.

Only prevent the generation of the \texttt{value} attribute when the
value is \code{None}.

\subsubsection{\texttt{<al-input>} tag\label{rel-1.10-modpython}}

The \module{apacheapp} \class{Request} class now works for mod_python
2.3 and 3.0.
