README
1 ************************************
2 * Clearsilver README
3 ************************************
4
5 For more information, see the website:
6
7 http://www.clearsilver.net/
8
9 This package includes Clearsilver, the CGI kit and HTML templating
10 system. For information about building and installing, see the
11 included INSTALL file. This package also includes tools which
12 help you use Clearsilver, as well as a few examples.
13
14 ************************************************************
15 *** Clearsilver
16
17 * Clearsilver - This is our html template system and cgi kit.
18
19 There are too many great things about clearsilver to list them all
20 here, but here are some of the salient points:
21
22 * get the html out of your code
23 * loops, conditionals, macros, and stuff
24 * cgi kit unifies query variable and cookie handling
25 * super-easy to go from static mockup to dynamic page
26 * run multiple front-ends on the same application code
27 * super-fast C-library
28 * unifies Query variable and cookie handling
29 * language neutral (C,C++,Python,Ruby,Perl,Java,C#)
30 * nice iterative page debugging/development features
31 * generate static-data-driven page content without using any code
32 * did I mention super-fast?
33
34 Supported language information:
35
36 README.python
37
38 *************************************************************
39 *** Tools
40
41 * trans.py
42
43 This is our transparent translation system. It's based on how we did
44 translation at Yahoo!. You leave all the english strings right in the
45 clearsilver templates. trans parses the html and extracts your
46 language strings into a translation database. You can then translate
47 the strings using any means. (it includes tools for dump and loading
48 per-language files for shipping to translators). Occasionally trans
49 isn't smart enough to find your language strings, in this case you can
50 manually extract them into static language string files and trans will
51 automatically pick them up. When it comes time to ship, trans
52 generates language-independent templates, and a set of language files
53 from your database.
54
55 *************************************************************
56 *** Examples
57
58 * static.cgi
59
60 This is a standalone binary which handles Clearsilver rendering of
61 static content. This is a great way to play with clearsilver syntax
62 before you start writing dynamic CGIs with it. This is also a great
63 way to do webpage mockups with much more power than server side
64 includes. See the INSTALL file for information about configuring
65 this for use with apache.
66
67
README.python
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
11 Either one is fine, the goal is to load all Python code once, before
12 Apache forks. Then, for every web-request, Apache just makes a
13 function call into the Python environment which serves the page. This
14 is "really fast" as it gets rid of all of the parsing and loading of
15 Python. Various versions of PyApache and mod_python have gained and
16 lost and gained again the ability to do this well. We used a hacked
17 version of PyApache way back when, I think mod_python does this out of
18 the box today.
19
20
21
22 ************************************************************
23 *** Python Tools
24
25 * CSPage.py
26
27 This is our "page rendering superclass". It's pretty simple and has
28 nice machinery for some of the stuff talked about on this list. For
29 example, it has nice debugging and redirect support, and it has a
30 mechanism for mapping form submit buttons to method names. Here is an
31 example 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
50 This is an object to relational database mapping tool. It makes
51 interacting with SQL databases really easy. It gives you a place to
52 put all your SQL code. It also could be changed to work with flat
53 files as well. We have some nice hooks to connect this to Clearsilver,
54 so rendering database data into webpages is really easy. Here is an
55 example:
56
57 rows = mydb.mytable.fetchAllRows() # fetch all rows
58 rows.hdfExport("CGI.tabledata",ncgi.hdf) # export them into the dataset
59
60 # it is also really easy to change rows:
61
62 row = mydb.mytable.fetchRow( ('user', 'jeske') )
63 row.email = 'jeske at chat.net'
64 row.save()
65
66