1.1 --- a/docs/XSLForms-resource.html Tue Oct 25 17:52:28 2005 +0000
1.2 +++ b/docs/XSLForms-resource.html Wed Oct 26 00:07:09 2005 +0000
1.3 @@ -11,7 +11,7 @@
1.4 from this class, <code>XSLFormsResource</code>,
1.5 you can derive your own application-specific resources and use the
1.6 class's API to obtain, manipulate and present form data. Although the
1.7 -supplied <a href="../apidocs/index.html">API documentation</a> provides details of the class's API, specifically in the <code><a href="../apidocs/public/XSLForms.Resources-module.html">XSLForms.Resources</a></code><a href="../apidocs/public/XSLForms.Resources-module.html"></a> module, this document attempts to explain how the API is used in practice.</p><h2>Resource Structure</h2><p>The structure of a Web resource derived from <code>XSLFormsResource</code> should look like this:</p><pre>class MyResource(XSLForms.Resources.XSLFormsResource):<br /><br /> [Resource definitions]<br /><br /> def respond_to_form(self, trans, form):<br /> [Examine the form data, see if the user has added or removed anything.]<br /> [Perform additional processing and initialise the form data.]<br /> [Produce some kind of response to show the user the updated form data.]</pre><p>Since <code>XSLFormsResource</code> builds on WebStack's resource mechanisms, we do have the transaction object, <code>trans</code>, available. However, most of the information we need to access and manipulate is generally available through the <code>form</code> object.</p><h2>Defining Resources</h2><p>Classes derived from <code>XSLFormsResource</code>
1.8 +supplied <a href="../apidocs/index.html">API documentation</a> provides details of the class's API, specifically in the <code><a href="../apidocs/public/XSLForms.Resources.WebResources-module.html">XSLForms.Resources.WebResources</a></code><a href="../apidocs/public/XSLForms.Resources.WebResources-module.html"></a> module, this document attempts to explain how the API is used in practice.</p><h2>Resource Structure</h2><p>The structure of a Web resource derived from <code>XSLFormsResource</code> should look like this:</p><pre>class MyResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> [Resource definitions]<br /><br /> def respond_to_form(self, trans, form):<br /> [Examine the form data, see if the user has added or removed anything.]<br /> [Perform additional processing and initialise the form data.]<br /> [Produce some kind of response to show the user the updated form data.]</pre><p>Since <code>XSLFormsResource</code> builds on WebStack's resource mechanisms, we do have the transaction object, <code>trans</code>, available. However, most of the information we need to access and manipulate is generally available through the <code>form</code> object.</p><h2>Defining Resources</h2><p>Classes derived from <code>XSLFormsResource</code>
1.9 support the concept of resources which are used to produce output,
1.10 support processing and to provide access to useful information. At the
1.11 class level it is essential to define at least some of these resources
1.12 @@ -19,7 +19,7 @@
1.13 XSLForms relies on template files residing in the filesystem, along
1.14 with other files, we need to define where such files can be found (as
1.15 described in the <a href="directory.html">"Creating Applications: Create
1.16 -a Directory"</a> document). Consequently, it is the convention that all resource classes define such information as follows:</p><pre>class ConfiguratorResource(XSLForms.Resources.XSLFormsResource):<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")</pre><p>All
1.17 +a Directory"</a> document). Consequently, it is the convention that all resource classes define such information as follows:</p><pre>class ConfiguratorResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")</pre><p>All
1.18 filenames, defined in the various resource sections (as described
1.19 below) must be stated without leading path information - in other
1.20 words, as "leafnames" rather than "pathnames". Thus, an example of
1.21 @@ -204,4 +204,4 @@
1.22 enough flexibility when introducing additional information into a
1.23 transformation. An alternative approach involves copying data into the
1.24 document to be processed and then to supply references to the data in
1.25 -its new location within the document.</p></body></html>
1.26 \ No newline at end of file
1.27 +its new location within the document.</p></body></html>