Commit ee1051cf authored by Fred Drake's avatar Fred Drake

Add support for loading from file objects.

parent d47341c5
...@@ -183,7 +183,7 @@ sections: ...@@ -183,7 +183,7 @@ sections:
\declaremodule{}{ZConfig} \declaremodule{}{ZConfig}
\modulesynopsis{Configuration package} \modulesynopsis{Configuration package}
The main \module{ZConfig} package exports a single function: The main \module{ZConfig} package exports two convenience functions:
\begin{funcdesc}{load}{url} \begin{funcdesc}{load}{url}
Load and return a configuration from a URL or pathname given by Load and return a configuration from a URL or pathname given by
...@@ -191,6 +191,14 @@ The main \module{ZConfig} package exports a single function: ...@@ -191,6 +191,14 @@ The main \module{ZConfig} package exports a single function:
pathname. Fragment identifiers are not supported. pathname. Fragment identifiers are not supported.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{loadfile}{file\optional{, url}}
Load and return a configuration from an opened file object.
If \var{url} is omitted, one will be computed based on the
\member{name} attribute of \var{file}, if it exists. If no URL can
be determined, all \keyword{include} statements in the configuration
must use absolute URLs.
\end{funcdesc}
\section{\module{ZConfig.Context} --- Application context} \section{\module{ZConfig.Context} --- Application context}
...@@ -218,8 +226,9 @@ subclassed, so this should not prove to be difficult. ...@@ -218,8 +226,9 @@ subclassed, so this should not prove to be difficult.
replacement of the class. replacement of the class.
\end{classdesc} \end{classdesc}
The context object offers one method that is intended to be called The context object offers two methods that are used to load a
once: configuration. Exactly one of these methods should be called, and it
should be called only once:
\begin{methoddesc}{load}{url} \begin{methoddesc}{load}{url}
Load and return a configuration object from a resource. The Load and return a configuration object from a resource. The
...@@ -227,6 +236,14 @@ once: ...@@ -227,6 +236,14 @@ once:
Fragment identifiers are not supported. Fragment identifiers are not supported.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{loadfile}{file\optional{, url}}
Load and return a configuration from an opened file object.
If \var{url} is omitted, one will be computed based on the
\member{name} attribute of \var{file}, if it exists. If no URL can
be determined, all \keyword{include} statements in the configuration
must use absolute URLs.
\end{methoddesc}
The following methods are defined to be individually overridable by The following methods are defined to be individually overridable by
subclasses; this should suffice for most context specialization. subclasses; this should suffice for most context specialization.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment