[Twisted-Python] row.html howto XHTML compliance [PATCH]

Jonathan Lange jml at mumak.net
Tue Sep 17 19:24:34 EDT 2002


G'day all,

I noticed that admin/generate-domdocs failed on row.html, so I patched
it to be a well-formed XHTML document (and to have lowercase tags ;)

Patch below!

Cheers,
jml

Index: doc/howto/row.html
===================================================================
RCS file: /cvs/Twisted/doc/howto/row.html,v
retrieving revision 1.9
diff -r1.9 row.html
1,5c1,9
< <HTML>
< <HEAD>
<   <TITLE>Twisted Enterprise Row Objects</TITLE>
< </HEAD>
< <BODY>
---
> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> 
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
>   <title>Twisted Enterprise Row Objects</title>
> </head>
> <body>
7c11
< <H1>Twisted Enterprise Row Objects</H1>
---
> <h1>Twisted Enterprise Row Objects</h1>
9c13
< <P>The <CODE>twisted.enterprise.row</CODE> module is a method
---
> <p>The <code>twisted.enterprise.row</code> module is a method
11c15
< tables. It has two components: the <CODE>RowObject</CODE> class
---
> tables. It has two components: the <code>RowObject</code> class
13c17
< code interacts with, and the <CODE>DBReflector</CODE> which generates
---
> code interacts with, and the <code>DBReflector</code> which generates
15c19
< deletes against the database.</P>
---
> deletes against the database.</p>
17c21
< <P>The row module is intended for applications such as on-line
---
> <p>The row module is intended for applications such as on-line
24c28
< to an existing python application.</P>
---
> to an existing python application.</p>
26c30
< <P>Currently, the row module requires the use of PostgreSQL.</P>
---
> <p>Currently, the row module requires the use of PostgreSQL.</p>
28c32
< <H2>Class Definitions</H2>
---
> <h2>Class Definitions</h2>
30,31c34,35
< <P>To interface to relational database tables, the developer must
< create a class derived from the
<CODE>twisted.enterprise.row.RowObject</CODE>
---
> <p>To interface to relational database tables, the developer must
> create a class derived from the
<code>twisted.enterprise.row.RowObject</code>
35c39
< are:</P>
---
> are:</p>
37,42c41,46
< <UL>
<   <LI>rowColumns - list of the columns in the table with the correct
<   case
<   <LI>rowKeyColumns - list of key columns in form: [(columnName,
<   typeName)]
<   <LI>rowTableName - the name of the database table
---
> <ul>
>   <li>rowColumns - list of the columns in the table with the correct
>   case</li>
>   <li>rowKeyColumns - list of key columns in form: [(columnName,
>   typeName)]</li>
>   <li>rowTableName - the name of the database table</li>
45c49
< <P>There are also two optional class attributes that can be
specified:</P>
---
> <p>There are also two optional class attributes that can be
specified:</p>
47,48c51,52
< <UL>
<   <LI>rowForeignKeys - list of foreign keys to other database tables
---
> <ul>
>   <li>rowForeignKeys - list of foreign keys to other database tables
50,53c54,57
<   autoLoad]
<   <LI>rowFactoryMethod - a method that creates instances of this
<   class
< </UL>
---
>   autoLoad]</li>
>   <li>rowFactoryMethod - a method that creates instances of this
>   class</li>
> </ul>
55c59
< <P>For example:</P>
---
> <p>For example:</p>
57c61
< <PRE>
---
> <pre class="python">
62c66,67
<     rowFactoryMethod = [myRowFactory]</PRE>
---
>     rowFactoryMethod = [myRowFactory]
> </pre>
64,65c69,70
< <P>The items in the rowColumns list will become data members of
< classes of this type when they are created by the DBReflector.</P>
---
> <p>The items in the rowColumns list will become data members of
> classes of this type when they are created by the DBReflector.</p>
67c72
< <H2>Initialization</H2>
---
> <h2>Initialization</h2>
69c74
< <P>The initialization phase builds the SQL for the database
interactions.
---
> <p>The initialization phase builds the SQL for the database
interactions.
73c78
< are passed to the DBReflector when it is created.</P>
---
> are passed to the DBReflector when it is created.</p>
75c80
< <P>An example class list for the RoomRow class we specified above:</P>
---
> <p>An example class list for the RoomRow class we specified above:</p>
77c82
< <PRE>
---
> <pre class="python">
82c87,88
< reflector = row.DBReflector( dbpool, [RoomRow], runTests )</PRE>
---
> reflector = row.DBReflector( dbpool, [RoomRow], runTests )
> </pre>
84c90
< <H2>Creating Row Objects</H2>
---
> <h2>Creating Row Objects</h2>
86,87c92,93
< <P>There are two methods of creating RowObjects - loading from
< the database, and creating a new instance ready to be inserted.</P>
---
> <p>There are two methods of creating RowObjects - loading from
> the database, and creating a new instance ready to be inserted.</p>
89c95
< <P>To load rows from the database and create RowObject instances
---
> <p>To load rows from the database and create RowObject instances
94c100
< example:</P>
---
> example:</p>
96c102
< <PRE>
---
> <pre class="python">
101c107,108
< refector.loadObjectsFrom(&quot;testrooms&quot;,
whereClause=[(&quot;id&quot;, reflector.EQUAL,
5)]).addCallback(gotRooms)</PRE>
---
> refector.loadObjectsFrom(&quot;testrooms&quot;,
whereClause=[(&quot;id&quot;, reflector.EQUAL,
5)]).addCallback(gotRooms)
> </pre>
103c110
< <P>For more advanced RowObject construction, loadObjectsFrom may
---
> <p>For more advanced RowObject construction, loadObjectsFrom may
110c117
< before exposing the data to user code. An example factory method:</P>
---
> before exposing the data to user code. An example factory method:</p>
112c119
< <PRE>
---
> <pre class="python">
116c123
<     return newRoom</PRE>
---
>     return newRoom</pre>
118c125
< <P>The last method of creating a row object is for new instances
---
> <p>The last method of creating a row object is for new instances
122c129
< method of the DBReflector. For example:</P>
---
> method of the DBReflector. For example:</p>
124c131
< <PRE>
---
> <pre class="python">
134c141,142
<     reflector.insertRow(newRoom).addCallback(onInsert)</PRE>
---
>     reflector.insertRow(newRoom).addCallback(onInsert)
> </pre>
136c144
< <P>This will insert a new row into the database table for this
---
> <p>This will insert a new row into the database table for this
141c149
< from being changed by mistake.</P>
---
> from being changed by mistake.</p>
143d150
< <P>&nbsp;</P>
145c152
< <H2>Relationships Between Tables</H2>
---
> <h2>Relationships Between Tables</h2>
147,154c154,162
< <P>Specifying a foreign key for a RowClass creates a relationship
< between database tables. When <I>loadObjectsFrom</I> is called for a
< table, it will automatically load all the children rows for the rows
< from the specified table. The child rows will be put into a list
< member variable of the rowObject instance with the name "childRows" or
< if a <i>containerMethod</i> is specified for the foreign key
< relationship, that method will be called on the parent row object for
< each row that is being added to it as a child.</P>
---
> <p>Specifying a foreign key for a RowClass creates a relationship
> between database tables. When <code
> class="python">loadObjectsFrom</code> is called for a table, it will
> automatically load all the children rows for the rows from the
specified
> table. The child rows will be put into a list member variable of the
> rowObject instance with the name "childRows" or if a
> <i>containerMethod</i> is specified for the foreign key relationship,
> that method will be called on the parent row object for each row that
is
> being added to it as a child.</p>
156c164
< <P>The <i>autoLoad</i> member of the foreign key definition is a flag
---
> <p>The <i>autoLoad</i> member of the foreign key definition is a flag
158c166
< relationship when a parent row is loaded.
---
> relationship when a parent row is loaded.</p>
160c168
< <H2>Duplicate Row Objects</H2>
---
> <h2>Duplicate Row Objects</h2>
162c170
< <P>If a reflector tries to load an instance of a rowObject that
---
> <p>If a reflector tries to load an instance of a rowObject that
166c174
< unique keys for this purpose.</P>
---
> unique keys for this purpose.</p>
168c176
< <H2>Updating Row Objects</H2>
---
> <h2>Updating Row Objects</h2>
170c178
< <P>RowObjects have a &quot;dirty&quot; member attribute that is
---
> <p>RowObjects have a &quot;dirty&quot; member attribute that is
176c184
< (be sure to call the base class setDirty though!).</P>
---
> (be sure to call the base class setDirty though!).</p>
178c186
< <P>When it is determined that a RowObject instance is dirty and
---
> <p>When it is determined that a RowObject instance is dirty and
180c188
< to the &quot;updateRow&quot; method of the DBReflector. For
example:</P>
---
> to the &quot;updateRow&quot; method of the DBReflector. For
example:</p>
182,183c190,192
< <PRE>
<     reflector.updateRow(room).addCallback(onUpdated)</PRE>
---
> <pre class="python">
> reflector.updateRow(room).addCallback(onUpdated)\
> </pre>
185c194
< <P>For more complex behavior, the reflector can generate the SQL
---
> <p>For more complex behavior, the reflector can generate the SQL
187c196
< for batching up multiple updates into single requests. For
example:</P>
---
> for batching up multiple updates into single requests. For
example:</p>
189,190c198,200
< <PRE>
<     updateSQL = reflector.updateRowSQL(room)</PRE>
---
> <pre class="python">
> updateSQL = reflector.updateRowSQL(room)\
> </pre>
192c202
< <H2>Deleting Row Objects</H2>
---
> <h2>Deleting Row Objects</h2>
194c204
< <P>To delete a row from a database pass the RowObject instance
---
> <p>To delete a row from a database pass the RowObject instance
196,197c206,207
< Deleting the python Rowobject instance does <EM>not</EM> automatically
< delete the row from the database. For example:</P>
---
> Deleting the python Rowobject instance does <em>not</em> automatically
> delete the row from the database. For example:</p>
199,200c209,211
< <PRE>
<     reflector.deleteRow(room)</PRE>
---
> <pre class="python">
> reflector.deleteRow(room)
> </pre>
202,203c213,214
< </BODY>
< </HTML>
---
> </body>
> </html>







More information about the Twisted-Python mailing list