1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/selectors.html Sun Jan 07 00:27:04 2007 +0000
1.3 @@ -0,0 +1,31 @@
1.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.5 +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />
1.6 +
1.7 + <title>Selectors - Components for Dispatching to Resources</title><meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.8 + <link href="styles.css" rel="stylesheet" type="text/css" /></head>
1.9 +<body>
1.10 +<h1>Selectors - Components for Dispatching to Resources</h1>
1.11 +<p>The <code>Selectors</code> module provides classes (although
1.12 +currently only one class is supplied) which act as standard WebStack
1.13 +resources, but which attempt to "select" other resources, dispatch each
1.14 +request to those resources, and to cause various side-effects, mostly
1.15 +on the attributes stored on the transaction object. These "selector"
1.16 +classes behave those in the <code>ResourceMap</code> module, but aspire to be more generally applicable.</p><h2>Introducing PathSelector</h2><p>In
1.17 +non-trivial applications, it is often desirable to know the path or URL
1.18 +to a particular resource, especially the "root" resource under which
1.19 +the application or one of its components may reside. The <code>PathSelector</code>
1.20 +class can be instantiated and be made to refer to a resource, recording
1.21 +such path or URL details in an attribute for later inspection.</p><div class="WebStack">
1.22 +<h3>WebStack API - The PathSelector Class</h3>
1.23 +
1.24 +<p>The <code>PathSelector</code>
1.25 +class (found in the
1.26 +<code>WebStack.Resources.Selectors</code> module) wraps resource
1.27 +objects whose location (as indicated by a path or URL) should be
1.28 +recorded as an attribute on the current transaction. The most common
1.29 +use of the class is to record the "root" resource's location,
1.30 +and this would be done as follows:</p><pre>def get_site_map():<br /> return PathSelector(MyResource())</pre><p>Here, the <code>get_site_map</code>
1.31 +function (as described in the <a href="deploying.html">"Deploying a WebStack Application"</a> document) would provide a <code>PathSelector</code> object instead of an instance of the <code>MyResource</code> class. However, the side-effect of combining these two resources would be the availability of an attribute named <code>root</code> on the transaction object. Thus, the "root" <code>MyResource</code>
1.32 +object and, indeed, all resource objects visited after this side-effect
1.33 +has occurred will have access to the "root" path or URL information.</p><h4>Further Reading</h4><p>The <a href="../apidocs/public/WebStack.Resources.Selectors.PathSelector-class.html">API documentation</a> for the <code>PathSelector</code>
1.34 +class provides additional information.</p></div></body></html>
1.35 \ No newline at end of file