Mercurial > p > roundup > code
comparison roundup/cgi/apache.py @ 2560:d45f1669599c
added 'TrackerLanguage' option;
pass message translator to the tracker client instance
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Mon, 12 Jul 2004 09:14:12 +0000 |
| parents | 41fbe26aa2df |
| children | 353dc16a49b2 |
comparison
equal
deleted
inserted
replaced
| 2559:6c096b4aea67 | 2560:d45f1669599c |
|---|---|
| 9 # | 9 # |
| 10 # This module operates with only one tracker | 10 # This module operates with only one tracker |
| 11 # and must be placed in the tracker directory. | 11 # and must be placed in the tracker directory. |
| 12 # | 12 # |
| 13 # History (most recent first): | 13 # History (most recent first): |
| 14 # 11-jul-2004 [als] added 'TrackerLanguage' option; | |
| 15 # pass message translator to the tracker client instance | |
| 14 # 04-jul-2004 [als] tracker lookup moved from module global to request handler; | 16 # 04-jul-2004 [als] tracker lookup moved from module global to request handler; |
| 15 # use PythonOption TrackerHome (configured in apache) | 17 # use PythonOption TrackerHome (configured in apache) |
| 16 # to open the tracker | 18 # to open the tracker |
| 17 # 06-may-2004 [als] use cgi.FieldStorage from Python library | 19 # 06-may-2004 [als] use cgi.FieldStorage from Python library |
| 18 # instead of mod_python FieldStorage | 20 # instead of mod_python FieldStorage |
| 19 # 29-apr-2004 [als] created | 21 # 29-apr-2004 [als] created |
| 20 | 22 |
| 21 __version__ = "$Revision: 1.1 $"[11:-2] | 23 __version__ = "$Revision: 1.2 $"[11:-2] |
| 22 __date__ = "$Date: 2004-07-06 10:25:42 $"[7:-2] | 24 __date__ = "$Date: 2004-07-12 09:14:12 $"[7:-2] |
| 23 | 25 |
| 24 import cgi | 26 import cgi |
| 25 import os | 27 import os |
| 26 | 28 |
| 27 from mod_python import apache | 29 from mod_python import apache |
| 28 | 30 |
| 29 import roundup.instance | 31 import roundup.instance |
| 32 from roundup.cgi import TranslationService | |
| 30 | 33 |
| 31 class Headers(dict): | 34 class Headers(dict): |
| 32 | 35 |
| 33 """HTTP headers wrapper""" | 36 """HTTP headers wrapper""" |
| 34 | 37 |
| 70 | 73 |
| 71 def handler(req): | 74 def handler(req): |
| 72 """HTTP request handler""" | 75 """HTTP request handler""" |
| 73 _options = req.get_options() | 76 _options = req.get_options() |
| 74 _home = _options.get("TrackerHome") | 77 _home = _options.get("TrackerHome") |
| 78 _lang = _options.get("TrackerLanguage") | |
| 75 if not (_home and os.path.isdir(_home)): | 79 if not (_home and os.path.isdir(_home)): |
| 76 apache.log_error( | 80 apache.log_error( |
| 77 "PythonOption TrackerHome missing or invalid for %(uri)s" | 81 "PythonOption TrackerHome missing or invalid for %(uri)s" |
| 78 % {'uri': req.uri}) | 82 % {'uri': req.uri}) |
| 79 return apache.HTTP_INTERNAL_SERVER_ERROR | 83 return apache.HTTP_INTERNAL_SERVER_ERROR |
| 86 # path = string.split(os.environ.get('PATH_INFO', '/'), '/') | 90 # path = string.split(os.environ.get('PATH_INFO', '/'), '/') |
| 87 # os.environ['PATH_INFO'] = string.join(path[2:], '/') | 91 # os.environ['PATH_INFO'] = string.join(path[2:], '/') |
| 88 # we just remove the first character ('/') | 92 # we just remove the first character ('/') |
| 89 _env["PATH_INFO"] = req.path_info[1:] | 93 _env["PATH_INFO"] = req.path_info[1:] |
| 90 _form = cgi.FieldStorage(req, environ=_env) | 94 _form = cgi.FieldStorage(req, environ=_env) |
| 91 _client = _tracker.Client(_tracker, Request(req), _env, _form) | 95 _client = _tracker.Client(_tracker, Request(req), _env, _form, |
| 96 translator=TranslationService.get_translation(_lang)) | |
| 92 _client.main() | 97 _client.main() |
| 93 return apache.OK | 98 return apache.OK |
| 94 | 99 |
| 95 # vim: set et sts=4 sw=4 : | 100 # vim: set et sts=4 sw=4 : |
