Show More
@@ -1,49 +1,49 b'' | |||||
1 | repoze.sendmail==4.1 |
|
1 | repoze.sendmail==4.1 | |
2 |
pyramid==1. |
|
2 | pyramid==1.10.2 | |
3 | pyramid_tm==0.12 |
|
3 | pyramid_tm==0.12 | |
4 | pyramid_debugtoolbar |
|
4 | pyramid_debugtoolbar | |
5 | pyramid_authstack==1.0.1 |
|
5 | pyramid_authstack==1.0.1 | |
6 | SQLAlchemy==1.0.12 |
|
6 | SQLAlchemy==1.0.12 | |
7 | alembic==1.0.8 |
|
7 | alembic==1.0.8 | |
8 | webhelpers2==2.0 |
|
8 | webhelpers2==2.0 | |
9 | transaction==1.4.3 |
|
9 | transaction==1.4.3 | |
10 | zope.sqlalchemy==0.7.6 |
|
10 | zope.sqlalchemy==0.7.6 | |
11 | pyramid_mailer==0.14.1 |
|
11 | pyramid_mailer==0.14.1 | |
12 | redis==2.10.5 |
|
12 | redis==2.10.5 | |
13 | redlock-py==1.0.8 |
|
13 | redlock-py==1.0.8 | |
14 | pyramid_jinja2==2.6.2 |
|
14 | pyramid_jinja2==2.6.2 | |
15 | psycopg2==2.7.7 |
|
15 | psycopg2==2.7.7 | |
16 | wtforms==2.1 |
|
16 | wtforms==2.1 | |
17 | celery==3.1.23 |
|
17 | celery==3.1.23 | |
18 | formencode==1.3.0 |
|
18 | formencode==1.3.0 | |
19 | psutil==2.1.2 |
|
19 | psutil==2.1.2 | |
20 | ziggurat_foundations==0.8.3 |
|
20 | ziggurat_foundations==0.8.3 | |
21 | bcrypt==3.1.6 |
|
21 | bcrypt==3.1.6 | |
22 | appenlight_client |
|
22 | appenlight_client | |
23 | markdown==2.5 |
|
23 | markdown==2.5 | |
24 | colander==1.7 |
|
24 | colander==1.7 | |
25 | defusedxml==0.5.0 |
|
25 | defusedxml==0.5.0 | |
26 | dogpile.cache==0.5.7 |
|
26 | dogpile.cache==0.5.7 | |
27 | pyramid_redis_sessions==1.0.1 |
|
27 | pyramid_redis_sessions==1.0.1 | |
28 | simplejson==3.8.2 |
|
28 | simplejson==3.8.2 | |
29 | waitress==1.0 |
|
29 | waitress==1.0 | |
30 | gunicorn==19.9.0 |
|
30 | gunicorn==19.9.0 | |
31 | requests==2.20.0 |
|
31 | requests==2.20.0 | |
32 | requests_oauthlib==0.6.1 |
|
32 | requests_oauthlib==0.6.1 | |
33 | gevent==1.1.1 |
|
33 | gevent==1.1.1 | |
34 | gevent-websocket==0.9.5 |
|
34 | gevent-websocket==0.9.5 | |
35 | pygments==2.1.3 |
|
35 | pygments==2.1.3 | |
36 | lxml==4.3.2 |
|
36 | lxml==4.3.2 | |
37 | paginate==0.5.4 |
|
37 | paginate==0.5.4 | |
38 | paginate-sqlalchemy==0.2.0 |
|
38 | paginate-sqlalchemy==0.2.0 | |
39 | pyelasticsearch==1.4 |
|
39 | pyelasticsearch==1.4 | |
40 | six>=1.10.0 |
|
40 | six>=1.10.0 | |
41 | mock==1.0.1 |
|
41 | mock==1.0.1 | |
42 | itsdangerous==1.1.0 |
|
42 | itsdangerous==1.1.0 | |
43 | camplight==0.9.6 |
|
43 | camplight==0.9.6 | |
44 | jira==1.0.7 |
|
44 | jira==1.0.7 | |
45 | python-dateutil==2.5.3 |
|
45 | python-dateutil==2.5.3 | |
46 | authomatic==0.1.0.post1 |
|
46 | authomatic==0.1.0.post1 | |
47 | cryptography==2.6.1 |
|
47 | cryptography==2.6.1 | |
48 | webassets==0.11.1 |
|
48 | webassets==0.11.1 | |
49 |
|
49 |
@@ -1,225 +1,225 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright 2010 - 2017 RhodeCode GmbH and the AppEnlight project authors |
|
3 | # Copyright 2010 - 2017 RhodeCode GmbH and the AppEnlight project authors | |
4 | # |
|
4 | # | |
5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | # Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | # you may not use this file except in compliance with the License. |
|
6 | # you may not use this file except in compliance with the License. | |
7 | # You may obtain a copy of the License at |
|
7 | # You may obtain a copy of the License at | |
8 | # |
|
8 | # | |
9 | # http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | # http://www.apache.org/licenses/LICENSE-2.0 | |
10 | # |
|
10 | # | |
11 | # Unless required by applicable law or agreed to in writing, software |
|
11 | # Unless required by applicable law or agreed to in writing, software | |
12 | # distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | # distributed under the License is distributed on an "AS IS" BASIS, | |
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | # See the License for the specific language governing permissions and |
|
14 | # See the License for the specific language governing permissions and | |
15 | # limitations under the License. |
|
15 | # limitations under the License. | |
16 |
|
16 | |||
17 | import datetime |
|
17 | import datetime | |
18 | import logging |
|
18 | import logging | |
19 | import pyelasticsearch |
|
19 | import pyelasticsearch | |
20 | import redis |
|
20 | import redis | |
21 | import os |
|
21 | import os | |
22 | import pkg_resources |
|
22 | import pkg_resources | |
23 | from pkg_resources import iter_entry_points |
|
23 | from pkg_resources import iter_entry_points | |
24 |
|
24 | |||
25 | import appenlight.lib.jinja2_filters as jinja2_filters |
|
25 | import appenlight.lib.jinja2_filters as jinja2_filters | |
26 | import appenlight.lib.encryption as encryption |
|
26 | import appenlight.lib.encryption as encryption | |
27 |
|
27 | |||
28 | from pyramid.config import PHASE3_CONFIG |
|
28 | from pyramid.config import PHASE3_CONFIG | |
29 | from pyramid.authentication import AuthTktAuthenticationPolicy |
|
29 | from pyramid.authentication import AuthTktAuthenticationPolicy | |
30 | from pyramid.authorization import ACLAuthorizationPolicy |
|
30 | from pyramid.authorization import ACLAuthorizationPolicy | |
31 | from pyramid_mailer.interfaces import IMailer |
|
31 | from pyramid_mailer.interfaces import IMailer | |
32 | from pyramid.renderers import JSON |
|
32 | from pyramid.renderers import JSON | |
33 | from pyramid_redis_sessions import session_factory_from_settings |
|
33 | from pyramid_redis_sessions import session_factory_from_settings | |
34 | from pyramid.settings import asbool, aslist |
|
34 | from pyramid.settings import asbool, aslist | |
35 | from pyramid.security import AllPermissionsList |
|
35 | from pyramid.security import AllPermissionsList | |
36 | from pyramid_authstack import AuthenticationStackPolicy |
|
36 | from pyramid_authstack import AuthenticationStackPolicy | |
37 | from redlock import Redlock |
|
37 | from redlock import Redlock | |
38 | from sqlalchemy import engine_from_config |
|
38 | from sqlalchemy import engine_from_config | |
39 |
|
39 | |||
40 | from appenlight.celery import configure_celery |
|
40 | from appenlight.celery import configure_celery | |
41 | from appenlight.lib.configurator import (CythonCompatConfigurator, |
|
41 | from appenlight.lib.configurator import (CythonCompatConfigurator, | |
42 | register_appenlight_plugin) |
|
42 | register_appenlight_plugin) | |
43 | from appenlight.lib import cache_regions |
|
43 | from appenlight.lib import cache_regions | |
44 | from appenlight.lib.ext_json import json |
|
44 | from appenlight.lib.ext_json import json | |
45 | from appenlight.security import groupfinder, AuthTokenAuthenticationPolicy |
|
45 | from appenlight.security import groupfinder, AuthTokenAuthenticationPolicy | |
46 |
|
46 | |||
47 | __license__ = 'Apache 2.0' |
|
47 | __license__ = 'Apache 2.0' | |
48 | __author__ = 'RhodeCode GmbH' |
|
48 | __author__ = 'RhodeCode GmbH' | |
49 | __url__ = 'http://rhodecode.com' |
|
49 | __url__ = 'http://rhodecode.com' | |
50 | __version__ = pkg_resources.get_distribution("appenlight").parsed_version |
|
50 | __version__ = pkg_resources.get_distribution("appenlight").parsed_version | |
51 |
|
51 | |||
52 | json_renderer = JSON(serializer=json.dumps, indent=4) |
|
52 | json_renderer = JSON(serializer=json.dumps, indent=4) | |
53 |
|
53 | |||
54 | log = logging.getLogger(__name__) |
|
54 | log = logging.getLogger(__name__) | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | def datetime_adapter(obj, request): |
|
57 | def datetime_adapter(obj, request): | |
58 | return obj.isoformat() |
|
58 | return obj.isoformat() | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | def all_permissions_adapter(obj, request): |
|
61 | def all_permissions_adapter(obj, request): | |
62 | return '__all_permissions__' |
|
62 | return '__all_permissions__' | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | json_renderer.add_adapter(datetime.datetime, datetime_adapter) |
|
65 | json_renderer.add_adapter(datetime.datetime, datetime_adapter) | |
66 | json_renderer.add_adapter(AllPermissionsList, all_permissions_adapter) |
|
66 | json_renderer.add_adapter(AllPermissionsList, all_permissions_adapter) | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | def main(global_config, **settings): |
|
69 | def main(global_config, **settings): | |
70 | """ This function returns a Pyramid WSGI application. |
|
70 | """ This function returns a Pyramid WSGI application. | |
71 | """ |
|
71 | """ | |
72 | auth_tkt_policy = AuthTktAuthenticationPolicy( |
|
72 | auth_tkt_policy = AuthTktAuthenticationPolicy( | |
73 | settings['authtkt.secret'], |
|
73 | settings['authtkt.secret'], | |
74 | hashalg='sha512', |
|
74 | hashalg='sha512', | |
75 | callback=groupfinder, |
|
75 | callback=groupfinder, | |
76 | max_age=2592000, |
|
76 | max_age=2592000, | |
77 | secure=asbool(settings.get('authtkt.secure', 'false'))) |
|
77 | secure=asbool(settings.get('authtkt.secure', 'false'))) | |
78 | auth_token_policy = AuthTokenAuthenticationPolicy( |
|
78 | auth_token_policy = AuthTokenAuthenticationPolicy( | |
79 | callback=groupfinder |
|
79 | callback=groupfinder | |
80 | ) |
|
80 | ) | |
81 | authorization_policy = ACLAuthorizationPolicy() |
|
81 | authorization_policy = ACLAuthorizationPolicy() | |
82 | authentication_policy = AuthenticationStackPolicy() |
|
82 | authentication_policy = AuthenticationStackPolicy() | |
83 | authentication_policy.add_policy('auth_tkt', auth_tkt_policy) |
|
83 | authentication_policy.add_policy('auth_tkt', auth_tkt_policy) | |
84 | authentication_policy.add_policy('auth_token', auth_token_policy) |
|
84 | authentication_policy.add_policy('auth_token', auth_token_policy) | |
85 | # set crypto key |
|
85 | # set crypto key | |
86 | encryption.ENCRYPTION_SECRET = settings.get('encryption_secret') |
|
86 | encryption.ENCRYPTION_SECRET = settings.get('encryption_secret') | |
87 | # import this later so encyption key can be monkeypatched |
|
87 | # import this later so encyption key can be monkeypatched | |
88 | from appenlight.models import DBSession, register_datastores |
|
88 | from appenlight.models import DBSession, register_datastores | |
89 |
|
89 | |||
90 | # registration |
|
90 | # registration | |
91 | settings['appenlight.disable_registration'] = asbool( |
|
91 | settings['appenlight.disable_registration'] = asbool( | |
92 | settings.get('appenlight.disable_registration')) |
|
92 | settings.get('appenlight.disable_registration')) | |
93 |
|
93 | |||
94 | # update config with cometd info |
|
94 | # update config with cometd info | |
95 | settings['cometd_servers'] = {'server': settings['cometd.server'], |
|
95 | settings['cometd_servers'] = {'server': settings['cometd.server'], | |
96 | 'secret': settings['cometd.secret']} |
|
96 | 'secret': settings['cometd.secret']} | |
97 |
|
97 | |||
98 | # Create the Pyramid Configurator. |
|
98 | # Create the Pyramid Configurator. | |
99 | settings['_mail_url'] = settings['mailing.app_url'] |
|
99 | settings['_mail_url'] = settings['mailing.app_url'] | |
100 | config = CythonCompatConfigurator( |
|
100 | config = CythonCompatConfigurator( | |
101 | settings=settings, |
|
101 | settings=settings, | |
102 | authentication_policy=authentication_policy, |
|
102 | authentication_policy=authentication_policy, | |
103 | authorization_policy=authorization_policy, |
|
103 | authorization_policy=authorization_policy, | |
104 | root_factory='appenlight.security.RootFactory', |
|
104 | root_factory='appenlight.security.RootFactory', | |
105 | default_permission='view') |
|
105 | default_permission='view') | |
106 | # custom registry variables |
|
106 | # custom registry variables | |
107 |
|
107 | |||
108 | # resource type information |
|
108 | # resource type information | |
109 | config.registry.resource_types = ['resource', 'application'] |
|
109 | config.registry.resource_types = ['resource', 'application'] | |
110 | # plugin information |
|
110 | # plugin information | |
111 | config.registry.appenlight_plugins = {} |
|
111 | config.registry.appenlight_plugins = {} | |
112 |
|
112 | |||
113 | config.set_default_csrf_options(require_csrf=True, header='X-XSRF-TOKEN') |
|
113 | config.set_default_csrf_options(require_csrf=True, header='X-XSRF-TOKEN') | |
114 | config.add_view_deriver('appenlight.predicates.csrf_view', |
|
114 | config.add_view_deriver('appenlight.predicates.csrf_view', | |
115 | name='csrf_view') |
|
115 | name='csrf_view') | |
116 |
|
116 | |||
117 | # later, when config is available |
|
117 | # later, when config is available | |
118 | dogpile_config = {'url': settings['redis.url'], |
|
118 | dogpile_config = {'url': settings['redis.url'], | |
119 | "redis_expiration_time": 86400, |
|
119 | "redis_expiration_time": 86400, | |
120 | "redis_distributed_lock": True} |
|
120 | "redis_distributed_lock": True} | |
121 | cache_regions.regions = cache_regions.CacheRegions(dogpile_config) |
|
121 | cache_regions.regions = cache_regions.CacheRegions(dogpile_config) | |
122 | config.registry.cache_regions = cache_regions.regions |
|
122 | config.registry.cache_regions = cache_regions.regions | |
123 | engine = engine_from_config(settings, 'sqlalchemy.', |
|
123 | engine = engine_from_config(settings, 'sqlalchemy.', | |
124 | json_serializer=json.dumps) |
|
124 | json_serializer=json.dumps) | |
125 | DBSession.configure(bind=engine) |
|
125 | DBSession.configure(bind=engine) | |
126 |
|
126 | |||
127 | # json rederer that serializes datetime |
|
127 | # json rederer that serializes datetime | |
128 | config.add_renderer('json', json_renderer) |
|
128 | config.add_renderer('json', json_renderer) | |
129 |
config. |
|
129 | config.add_request_method('appenlight.lib.request.es_conn', 'es_conn', property=True) | |
130 |
config. |
|
130 | config.add_request_method('appenlight.lib.request.get_user', 'user', | |
131 | reify=True) |
|
131 | reify=True, property=True) | |
132 |
config. |
|
132 | config.add_request_method('appenlight.lib.request.get_csrf_token', | |
133 | 'csrf_token', reify=True) |
|
133 | 'csrf_token', reify=True, property=True) | |
134 |
config. |
|
134 | config.add_request_method('appenlight.lib.request.safe_json_body', | |
135 | 'safe_json_body', reify=True) |
|
135 | 'safe_json_body', reify=True, property=True) | |
136 |
config. |
|
136 | config.add_request_method('appenlight.lib.request.unsafe_json_body', | |
137 | 'unsafe_json_body', reify=True) |
|
137 | 'unsafe_json_body', reify=True, property=True) | |
138 | config.add_request_method('appenlight.lib.request.add_flash_to_headers', |
|
138 | config.add_request_method('appenlight.lib.request.add_flash_to_headers', | |
139 | 'add_flash_to_headers') |
|
139 | 'add_flash_to_headers') | |
140 | config.add_request_method('appenlight.lib.request.get_authomatic', |
|
140 | config.add_request_method('appenlight.lib.request.get_authomatic', | |
141 | 'authomatic', reify=True) |
|
141 | 'authomatic', reify=True) | |
142 |
|
142 | |||
143 | config.include('pyramid_redis_sessions') |
|
143 | config.include('pyramid_redis_sessions') | |
144 | config.include('pyramid_tm') |
|
144 | config.include('pyramid_tm') | |
145 | config.include('pyramid_jinja2') |
|
145 | config.include('pyramid_jinja2') | |
146 | config.include('pyramid_mailer') |
|
146 | config.include('pyramid_mailer') | |
147 | config.include('appenlight_client.ext.pyramid_tween') |
|
147 | config.include('appenlight_client.ext.pyramid_tween') | |
148 | config.include('ziggurat_foundations.ext.pyramid.sign_in') |
|
148 | config.include('ziggurat_foundations.ext.pyramid.sign_in') | |
149 | es_server_list = aslist(settings['elasticsearch.nodes']) |
|
149 | es_server_list = aslist(settings['elasticsearch.nodes']) | |
150 | redis_url = settings['redis.url'] |
|
150 | redis_url = settings['redis.url'] | |
151 | log.warning('Elasticsearch server list: {}'.format(es_server_list)) |
|
151 | log.warning('Elasticsearch server list: {}'.format(es_server_list)) | |
152 | log.warning('Redis server: {}'.format(redis_url)) |
|
152 | log.warning('Redis server: {}'.format(redis_url)) | |
153 | config.registry.es_conn = pyelasticsearch.ElasticSearch(es_server_list) |
|
153 | config.registry.es_conn = pyelasticsearch.ElasticSearch(es_server_list) | |
154 | config.registry.redis_conn = redis.StrictRedis.from_url(redis_url) |
|
154 | config.registry.redis_conn = redis.StrictRedis.from_url(redis_url) | |
155 |
|
155 | |||
156 | config.registry.redis_lockmgr = Redlock([settings['redis.redlock.url'], ], |
|
156 | config.registry.redis_lockmgr = Redlock([settings['redis.redlock.url'], ], | |
157 | retry_count=0, retry_delay=0) |
|
157 | retry_count=0, retry_delay=0) | |
158 | # mailer bw compat |
|
158 | # mailer bw compat | |
159 | config.registry.mailer = config.registry.getUtility(IMailer) |
|
159 | config.registry.mailer = config.registry.getUtility(IMailer) | |
160 |
|
160 | |||
161 | # Configure sessions |
|
161 | # Configure sessions | |
162 | session_factory = session_factory_from_settings(settings) |
|
162 | session_factory = session_factory_from_settings(settings) | |
163 | config.set_session_factory(session_factory) |
|
163 | config.set_session_factory(session_factory) | |
164 |
|
164 | |||
165 | # Configure renderers and event subscribers |
|
165 | # Configure renderers and event subscribers | |
166 | config.add_jinja2_extension('jinja2.ext.loopcontrols') |
|
166 | config.add_jinja2_extension('jinja2.ext.loopcontrols') | |
167 | config.add_jinja2_search_path('appenlight:templates') |
|
167 | config.add_jinja2_search_path('appenlight:templates') | |
168 | # event subscribers |
|
168 | # event subscribers | |
169 | config.add_subscriber("appenlight.subscribers.application_created", |
|
169 | config.add_subscriber("appenlight.subscribers.application_created", | |
170 | "pyramid.events.ApplicationCreated") |
|
170 | "pyramid.events.ApplicationCreated") | |
171 | config.add_subscriber("appenlight.subscribers.add_renderer_globals", |
|
171 | config.add_subscriber("appenlight.subscribers.add_renderer_globals", | |
172 | "pyramid.events.BeforeRender") |
|
172 | "pyramid.events.BeforeRender") | |
173 | config.add_subscriber('appenlight.subscribers.new_request', |
|
173 | config.add_subscriber('appenlight.subscribers.new_request', | |
174 | 'pyramid.events.NewRequest') |
|
174 | 'pyramid.events.NewRequest') | |
175 | config.add_view_predicate('context_type_class', |
|
175 | config.add_view_predicate('context_type_class', | |
176 | 'appenlight.predicates.contextTypeClass') |
|
176 | 'appenlight.predicates.contextTypeClass') | |
177 |
|
177 | |||
178 | register_datastores(es_conn=config.registry.es_conn, |
|
178 | register_datastores(es_conn=config.registry.es_conn, | |
179 | redis_conn=config.registry.redis_conn, |
|
179 | redis_conn=config.registry.redis_conn, | |
180 | redis_lockmgr=config.registry.redis_lockmgr) |
|
180 | redis_lockmgr=config.registry.redis_lockmgr) | |
181 |
|
181 | |||
182 | # base stuff and scan |
|
182 | # base stuff and scan | |
183 |
|
183 | |||
184 | # need to ensure webassets exists otherwise config.override_asset() |
|
184 | # need to ensure webassets exists otherwise config.override_asset() | |
185 | # throws exception |
|
185 | # throws exception | |
186 | if not os.path.exists(settings['webassets.dir']): |
|
186 | if not os.path.exists(settings['webassets.dir']): | |
187 | os.mkdir(settings['webassets.dir']) |
|
187 | os.mkdir(settings['webassets.dir']) | |
188 | config.add_static_view(path='appenlight:webassets', |
|
188 | config.add_static_view(path='appenlight:webassets', | |
189 | name='static', cache_max_age=3600) |
|
189 | name='static', cache_max_age=3600) | |
190 | config.override_asset(to_override='appenlight:webassets/', |
|
190 | config.override_asset(to_override='appenlight:webassets/', | |
191 | override_with=settings['webassets.dir']) |
|
191 | override_with=settings['webassets.dir']) | |
192 |
|
192 | |||
193 | config.include('appenlight.views') |
|
193 | config.include('appenlight.views') | |
194 | config.include('appenlight.views.admin') |
|
194 | config.include('appenlight.views.admin') | |
195 | config.scan(ignore=['appenlight.migrations', 'appenlight.scripts', |
|
195 | config.scan(ignore=['appenlight.migrations', 'appenlight.scripts', | |
196 | 'appenlight.tests']) |
|
196 | 'appenlight.tests']) | |
197 |
|
197 | |||
198 | config.add_directive('register_appenlight_plugin', |
|
198 | config.add_directive('register_appenlight_plugin', | |
199 | register_appenlight_plugin) |
|
199 | register_appenlight_plugin) | |
200 |
|
200 | |||
201 | for entry_point in iter_entry_points(group='appenlight.plugins'): |
|
201 | for entry_point in iter_entry_points(group='appenlight.plugins'): | |
202 | plugin = entry_point.load() |
|
202 | plugin = entry_point.load() | |
203 | plugin.includeme(config) |
|
203 | plugin.includeme(config) | |
204 |
|
204 | |||
205 | # include other appenlight plugins explictly if needed |
|
205 | # include other appenlight plugins explictly if needed | |
206 | includes = aslist(settings.get('appenlight.includes', [])) |
|
206 | includes = aslist(settings.get('appenlight.includes', [])) | |
207 | for inc in includes: |
|
207 | for inc in includes: | |
208 | config.include(inc) |
|
208 | config.include(inc) | |
209 |
|
209 | |||
210 | # run this after everything registers in configurator |
|
210 | # run this after everything registers in configurator | |
211 |
|
211 | |||
212 | def pre_commit(): |
|
212 | def pre_commit(): | |
213 | jinja_env = config.get_jinja2_environment() |
|
213 | jinja_env = config.get_jinja2_environment() | |
214 | jinja_env.filters['tojson'] = json.dumps |
|
214 | jinja_env.filters['tojson'] = json.dumps | |
215 | jinja_env.filters['toJSONUnsafe'] = jinja2_filters.toJSONUnsafe |
|
215 | jinja_env.filters['toJSONUnsafe'] = jinja2_filters.toJSONUnsafe | |
216 |
|
216 | |||
217 | config.action(None, pre_commit, order=PHASE3_CONFIG + 999) |
|
217 | config.action(None, pre_commit, order=PHASE3_CONFIG + 999) | |
218 |
|
218 | |||
219 | def wrap_config_celery(): |
|
219 | def wrap_config_celery(): | |
220 | configure_celery(config.registry) |
|
220 | configure_celery(config.registry) | |
221 |
|
221 | |||
222 | config.action(None, wrap_config_celery, order=PHASE3_CONFIG + 999) |
|
222 | config.action(None, wrap_config_celery, order=PHASE3_CONFIG + 999) | |
223 |
|
223 | |||
224 | app = config.make_wsgi_app() |
|
224 | app = config.make_wsgi_app() | |
225 | return app |
|
225 | return app |
General Comments 0
You need to be logged in to leave comments.
Login now