source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/environment.py @ 3536

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/environment.py@3536
Revision 3536, 1.3 KB checked in by cbyrom, 14 years ago (diff)

Upgrade the server code to make consistent with newer pylons codebase - v0.9.6.1.
This mainly involves the replacement of the Response object, and associated methods,
with the inbuild, default response object. Typical changes include:

render_response -> render - with required settings on the response object
made before the render call against the response object

Response(...) -> response.write() - for content + response.headers.. = .. for headers info

  • also included the replacement of depricated functions, as highlighted by

the server logging

Line 
1import os
2
3import webhelpers
4
5from pylons import config
6
7import ows_server.lib.app_globals as app_globals
8import ows_server.lib.helpers
9from ows_server.config.routing import make_map
10
11def load_environment(global_conf={}, app_conf={}):
12    # Setup our paths
13    root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
14    paths = {'root': root_path,
15             'controllers': os.path.join(root_path, 'controllers'),
16             'templates': [os.path.join(root_path, path) for path in \
17                           ('components', 'templates')],
18             'static_files': os.path.join(root_path, 'public')
19             }
20
21    # Initialize config with the basic options
22    config.init_app(global_conf, app_conf, package='ows_server',
23                    template_engine='kid', paths=paths)
24
25    config['pylons.g'] = app_globals.Globals()
26    config['pylons.h'] = ows_server.lib.helpers
27    config['routes.map'] = make_map()
28   
29    # The following template options are passed to your template engines
30    tmpl_options = config['buffet.template_options']
31    tmpl_options['myghty.log_errors'] = True
32    tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format)
33   
34    # Add your own template options config options here, note that all config options will override
35    # any Pylons config options   
Note: See TracBrowser for help on using the repository browser.