1.1 --- a/docs/integrating.html Sat Sep 08 16:01:41 2007 +0000
1.2 +++ b/docs/integrating.html Sat Sep 08 16:02:18 2007 +0000
1.3 @@ -1,19 +1,18 @@
1.4 +<?xml version="1.0" encoding="iso-8859-1"?>
1.5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.6 <html xmlns="http://www.w3.org/1999/xhtml">
1.7 <head>
1.8 <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />
1.9 <title>Integrating with Other Systems</title>
1.10 - <meta name="generator"
1.11 - content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.12 <link href="styles.css" rel="stylesheet" type="text/css" />
1.13 </head>
1.14 <body>
1.15 <h1>Integrating with Other Systems</h1>
1.16 <p>Most Web applications are not self-contained - instead of
1.17 -providing information which is written into the application
1.18 -code itself, they may often access data from other places or even
1.19 +providing information which is written into the application
1.20 +code itself, they may often access data from other places or even
1.21 communicate with other systems. Since applications may be very
1.22 -different in the way that they access external systems or the way
1.23 +different in the way that they access external systems or the way
1.24 in which they obtain external information, WebStack does not mandate
1.25 rigid mechanisms for hooking into such systems or loading such
1.26 information. Instead, it is recommended that applications import
1.27 @@ -51,7 +50,7 @@
1.28 the above code is itself imported into Python.</td>
1.29 </tr>
1.30 <tr>
1.31 - <td align="undefined" valign="undefined">Use the <code>urlopen</code>
1.32 + <td align="undefined" valign="undefined">Use the <code>urlopen</code>
1.33 function of <code>urllib</code> to actually access a remote service.</td>
1.34 <td align="undefined" valign="undefined">This happens in the
1.35 resource code each time the resource decides to access the service.</td>
1.36 @@ -100,20 +99,20 @@
1.37 control of the application - some database systems limit the number of
1.38 connections, for example, and if a large number of resources suddenly
1.39 became active, some of them would fail to obtain connections if the
1.40 -connection initialisation code were in the <code>respond</code>
1.41 +connection initialisation code were in the <code>respond</code>
1.42 method of the resource.</p>
1.43 <h2>Configuring Packages Globally</h2>
1.44 <p>Of course, the above resource might not be the only resource to use
1.45 database connections. It might then be tempting to initialise a
1.46 connection for each module whose resource needs (or, since as normal
1.47 Python classes we can put many resources in a single module, whose
1.48 -resources need) to access a database. But it would surely be more
1.49 +resources need) to access a database. But it would surely be more
1.50 convenient to define a single, central place to hold such global
1.51 resources.</p>
1.52 <p>One approach is to define a module which can be accessed by all
1.53 modules, and thus by all resources. Let us create such a module in the
1.54 file <code>Properties.py</code> which will reside alongside <code>MyApplication.py</code>
1.55 -(or whatever the application module is called). Inside the <code>Properties</code>
1.56 +(or whatever the application module is called). Inside the <code>Properties</code>
1.57 module we can write the following code:</p>
1.58 <pre>import mydb<br /><br />connection = mydb.connect("me", "myPassword")</pre>
1.59 <p>Now, in each module containing resources which need to access the