comparison MoinMoin/server/server_cgi.py @ 2338:b902f2397c68

rename server and request Implementations by adding a prefix server_, request_
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 05 Jul 2007 21:23:29 +0200
parents
children 80e1a910a2f1
comparison
equal deleted inserted replaced
2290:49188b1e803c 2338:b902f2397c68
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - CGI pseudo Server
4
5 This is not really a server, it is just so that CGI stuff (the real
6 server is likely Apache or IIS or some other std. CGI server) looks
7 similar to what we have for Twisted and standalone server.
8
9 Minimal usage:
10
11 from MoinMoin.server.server_cgi import CgiConfig, run
12
13 class Config(CgiConfig):
14 pass
15
16 run(Config)
17
18 See more options in CgiConfig class.
19
20 @copyright: 2006 MoinMoin:ThomasWaldmann
21 @license: GNU GPL, see COPYING for details.
22 """
23
24 from MoinMoin.server import Config
25 from MoinMoin.request import request_cgi
26
27 # Server globals
28 config = None
29
30 # ------------------------------------------------------------------------
31 # Public interface
32
33 class CgiConfig(Config):
34 """ CGI default config """
35
36 name = 'moin'
37 properties = {}
38 logPath = None
39
40 # Development options
41 hotshotProfile = None # e.g. "moin.prof"
42
43
44 def run(configClass):
45 """ Create and run a Cgi Request
46
47 See CgiConfig for available options
48
49 @param configClass: config class
50 """
51
52 config = configClass()
53
54 if config.hotshotProfile:
55 import hotshot
56 config.hotshotProfile = hotshot.Profile(config.hotshotProfile)
57 config.hotshotProfile.start()
58
59 request = request_cgi.Request(properties=config.properties)
60 request.run()
61
62 if config.hotshotProfile:
63 config.hotshotProfile.close()
64
65