~ubuntu-branches/ubuntu/oneiric/moin/oneiric-security

« back to all changes in this revision

Viewing changes to MoinMoin/server/server_cgi.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-03-30 12:55:34 UTC
  • mfrom: (0.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100330125534-4c2ufc1rok24447l
Tags: 1.9.2-2ubuntu1
* Merge from Debian testing (LP: #521834). Based on work by Stefan Ebner.
  Remaining changes:
 - Remove python-xml from Suggests field, the package isn't anymore in
   sys.path.
 - Demote fckeditor from Recommends to Suggests; the code was previously
   embedded in moin, but it was also disabled, so there's no reason for us
   to pull this in by default currently. Note: This isn't necessary anymore
   but needs a MIR for fckeditor, so postpone dropping this change until
   lucid+1
* debian/rules:
  - Replace hardcoded python2.5 with python* and hardcore python2.6 for ln
* debian/control.in: drop versioned depends on cdbs

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
    name = 'moin'
36
 
    properties = {}
37
 
 
38
 
    # Development options
39
 
    hotshotProfile = None # e.g. "moin.prof"
40
 
 
41
 
 
42
 
def run(configClass):
43
 
    """ Create and run a Cgi Request
44
 
 
45
 
    See CgiConfig for available options
46
 
 
47
 
    @param configClass: config class
48
 
    """
49
 
 
50
 
    config = configClass()
51
 
 
52
 
    if config.hotshotProfile:
53
 
        import hotshot
54
 
        config.hotshotProfile = hotshot.Profile(config.hotshotProfile)
55
 
        config.hotshotProfile.start()
56
 
 
57
 
    request = request_cgi.Request(properties=config.properties)
58
 
    request.run()
59
 
 
60
 
    if config.hotshotProfile:
61
 
        config.hotshotProfile.close()
62
 
 
63