1
2
3************************************************************
4*** Python Environment Information
5
6* Python      - we know it and love it
7* Apache      - the defacto standard
8
9* PyApache/mod_python
10
11Either one is fine, the goal is to load all Python code once, before
12Apache forks. Then, for every web-request, Apache just makes a
13function call into the Python environment which serves the page. This
14is "really fast" as it gets rid of all of the parsing and loading of
15Python. Various versions of PyApache and mod_python have gained and
16lost and gained again the ability to do this well. We used a hacked
17version of PyApache way back when, I think mod_python does this out of
18the box today.
19
20
21
22************************************************************
23*** Python Tools
24
25* CSPage.py
26
27This is our "page rendering superclass". It's pretty simple and has
28nice machinery for some of the stuff talked about on this list. For
29example, it has nice debugging and redirect support, and it has a
30mechanism for mapping form submit buttons to method names. Here is an
31example of how the form stuff works:
32
33 <form action="foo.py">
34   <input type=submit name="Action.Foo" value="Do Foo!">
35 </form>
36
37 class MyPage(CSPage):
38    def setup(self):
39        # this runs before everything else
40        pass
41    def display(self):
42        # this is a regular non-submission render
43        pass
44    def Action_Foo(self):
45        # this is run automatically when the Foo submit button is clicked
46        pass
47
48* odb.py
49
50This is an object to relational database mapping tool. It makes
51interacting with SQL databases really easy. It gives you a place to
52put all your SQL code. It also could be changed to work with flat
53files as well. We have some nice hooks to connect this to Clearsilver,
54so rendering database data into webpages is really easy. Here is an
55example:
56
57rows = mydb.mytable.fetchAllRows()        # fetch all rows
58rows.hdfExport("CGI.tabledata",ncgi.hdf)  # export them into the dataset
59
60# it is also really easy to change rows:
61
62row = mydb.mytable.fetchRow( ('user', 'jeske') )
63row.email = 'jeske at chat.net'
64row.save()
65
66