WebStack

docs/design.html

733:26865b172666
2007-11-12 paulb [project @ 2007-11-12 00:51:34 by paulb] Added a StringResource class for simple static resources. Introduced base classes for common authentication activities. Merged "app", "path" and "qs" fields into a single "app" field for login and redirection. Added support for OpenID authentication.
     1 <?xml version="1.0" encoding="iso-8859-1"?>     2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     3 <html xmlns="http://www.w3.org/1999/xhtml"><head>     4   <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />     5   <title>Application Design Considerations</title>     6   <link href="styles.css" rel="stylesheet" type="text/css" /></head>     7 <body>     8 <h1>Application Design Considerations</h1>     9 <p>When writing an application, we    10 must try and cover the three activities mentioned in our overview of    11 what a simple resource looks like:</p>    12 <ol>    13   <li>Examine the transaction, decide what the user wants to do.</li>    14   <li>Perform some kind of action with the information supplied.</li>    15   <li>Produce some kind of response which tells the user what happened.</li>    16 </ol>    17 <p>We briefly covered the third activity in the <a href="resources.html"><code>MyApplication</code>    18 example</a>, but for a real, properly-behaved application, we need to visit    19 each activity in detail.</p>    20 <h2>Examine the Transaction</h2>    21 <p>In WebStack, the transaction is an object which is passed into a    22 resource when a user makes contact with an application. This    23 transaction object effectively tells us what it is the user wants to    24 do; it does so through a number of different pieces of information    25 including the request method, headers, parameters, cookies and sessions.</p>    26 <p>The transaction object appears as the first parameter in a    27 resource's&nbsp;<code>respond</code> method:</p>    28     29 <pre>class MyResource:<br />    def respond(self, trans):<br />        [Here is where the code for the resource is written.]</pre>    30     31 <p>Within this activity,&nbsp;certain&nbsp;topics&nbsp;are of interest:</p>    32 <ul>    33   <li><a href="paths.html">URLs and Paths</a></li>    34   <li><a href="methods.html">Request Methods</a></li>    35   <li><a href="parameters.html">Request Parameters and Uploads</a></li>    36 </ul>    37 <p>For full information about transaction objects, see the API    38 documentation for the&nbsp;<a href="../apidocs/public/WebStack.Generic.Transaction-class.html"><code>WebStack.Generic.Transaction</code></a>    39 class.</p>    40     41 <h2>Perform Actions</h2>    42 <p>Of all activities summarised above, this is the most vague because    43 the kinds of actions performed by applications will vary substantially    44 depending on what the application is supposed to do. Indeed, it is    45 within this activity that most applications will probably be integrated    46 with other systems - they may access databases or Web services, for    47 example.</p>    48 <p>WebStack does not mandate any particular style of integration with    49 other systems. It is generally recommended that developers use    50 whichever Python modules or packages they prefer and just to import    51 these into their applications. See&nbsp;<a href="integrating.html">"Integrating    52 with Other Systems"</a> for advice on this subject.</p>    53 <h2>Produce a Response</h2>    54 <p>This activity was briefly covered in&nbsp;the <code>MyApplication</code>    55 example, but for "real world" applications the following topics must be    56 understood in more detail:</p>    57 <ul>    58   <li><a href="responses.html">Responses and Presentation</a></li>    59   <li><a href="state.html">Cookies, Sessions, Users and Persistent    60 Information</a></li>    61 </ul>    62 </body></html>