##// END OF EJS Templates
bootstrap-request: inject fake user so ishell and other can actually execute tasks or some other web-related calls
super-admin -
r4877:08673672 default
parent child Browse files
Show More
@@ -21,7 +21,6 b''
21 import os
21 import os
22 from pyramid.compat import configparser
22 from pyramid.compat import configparser
23 from pyramid.paster import bootstrap as pyramid_bootstrap, setup_logging # pragma: no cover
23 from pyramid.paster import bootstrap as pyramid_bootstrap, setup_logging # pragma: no cover
24 from pyramid.scripting import prepare
25
24
26 from rhodecode.lib.request import Request
25 from rhodecode.lib.request import Request
27
26
@@ -38,6 +37,8 b' def get_app_config(ini_path):'
38
37
39
38
40 def bootstrap(config_uri, options=None, env=None):
39 def bootstrap(config_uri, options=None, env=None):
40 from rhodecode.lib.utils2 import AttributeDict
41
41 if env:
42 if env:
42 os.environ.update(env)
43 os.environ.update(env)
43
44
@@ -49,6 +50,9 b' def bootstrap(config_uri, options=None, '
49 pass
50 pass
50
51
51 request = Request.blank('/', base_url=base_url)
52 request = Request.blank('/', base_url=base_url)
52
53 # fake inject a running user for bootstrap request !
54 request.user = AttributeDict({'username': 'bootstrap-user',
55 'user_id': 1,
56 'ip_addr': '127.0.0.1'})
53 return pyramid_bootstrap(config_uri, request=request, options=options)
57 return pyramid_bootstrap(config_uri, request=request, options=options)
54
58
General Comments 0
You need to be logged in to leave comments. Login now