|
a/ForgeClassic/sfx/middleware.py |
|
b/ForgeClassic/sfx/middleware.py |
|
... |
|
... |
13 |
def __init__(self, app, config):
|
13 |
def __init__(self, app, config):
|
14 |
self.app = app
|
14 |
self.app = app
|
15 |
self.config = config
|
15 |
self.config = config
|
16 |
self.environ_values = {
|
16 |
self.environ_values = {
|
17 |
'allura.sfx_session_manager': SFXSessionMgr(),
|
17 |
'allura.sfx_session_manager': SFXSessionMgr(),
|
18 |
'allura.sfx.site_db':engine_from_config(h.config_with_prefix(config, 'site_db.')),
|
|
|
19 |
'allura.sfx.mail_db':engine_from_config(h.config_with_prefix(config, 'mail_db.')),
|
|
|
20 |
'allura.sfx.task_db':engine_from_config(h.config_with_prefix(config, 'task_db.')),
|
|
|
21 |
'allura.sfx.epic_db':engine_from_config(h.config_with_prefix(config, 'epic_db.'))
|
|
|
22 |
}
|
18 |
}
|
23 |
self.environ_values['allura.sfx_session_manager'].setup_sessiondb_connection_pool(
|
19 |
self.environ_values['allura.sfx_session_manager'].setup_sessiondb_connection_pool(
|
24 |
config)
|
20 |
config)
|
25 |
M.site_meta.bind = self.environ_values['allura.sfx.site_db']
|
21 |
self.configure_databases(config)
|
26 |
M.mail_meta.bind = self.environ_values['allura.sfx.mail_db']
|
22 |
|
27 |
M.task_meta.bind = self.environ_values['allura.sfx.task_db']
|
23 |
def configure_databases(self, config):
|
28 |
M.epic_meta.bind =self.environ_values['allura.sfx.epic_db']
|
24 |
M.site_meta.bind = engine_from_config(h.config_with_prefix(config, 'site_db.'))
|
|
|
25 |
M.mail_meta.bind = engine_from_config(h.config_with_prefix(config, 'mail_db.'))
|
|
|
26 |
M.task_meta.bind = engine_from_config(h.config_with_prefix(config, 'task_db.'))
|
|
|
27 |
M.epic_meta.bind = engine_from_config(h.config_with_prefix(config, 'epic_db.'))
|
|
|
28 |
# Configure SFX Database Tables
|
|
|
29 |
T = M.tables
|
|
|
30 |
# Alexandria Tables
|
29 |
M.tables.mail_group_list = Table('mail_group_list', M.site_meta, autoload=True)
|
31 |
T.mail_group_list = Table('mail_group_list', M.site_meta, autoload=True)
|
30 |
M.tables.groups = Table(
|
32 |
T.groups = Table(
|
31 |
'groups', M.site_meta, autoload=True,
|
33 |
'groups', M.site_meta, autoload=True,
|
32 |
include_columns=['group_id', 'group_name', 'status']),
|
34 |
include_columns=['group_id', 'group_name', 'status'])
|
33 |
M.tables.mllist_subscriber = Table('mllist_subscriber', M.site_meta, autoload=True)
|
35 |
T.mllist_subscriber = Table('mllist_subscriber', M.site_meta, autoload=True)
|
34 |
M.tables.prweb_vhost = Table('prweb_vhost', M.site_meta, autoload=True)
|
36 |
T.prweb_vhost = Table('prweb_vhost', M.site_meta, autoload=True)
|
35 |
M.tables._mysql_auth = t = Table(
|
37 |
T._mysql_auth = t = Table(
|
36 |
'mysql_auth', M.site_meta, autoload=True,
|
38 |
'mysql_auth', M.site_meta, autoload=True,
|
37 |
)
|
39 |
)
|
38 |
M.tables.mysql_auth = select([
|
40 |
T.mysql_auth = select([
|
39 |
t,
|
41 |
t,
|
40 |
func.which_user(t.c.modified_by_uid).label('modified_user')]).alias('msql_auth_user')
|
42 |
func.which_user(t.c.modified_by_uid).label('modified_user')]).alias('msql_auth_user')
|
41 |
M.tables.backend_queue = Table('backend_queue', M.epic_meta, autoload=True)
|
43 |
# MailDB tables
|
42 |
M.tables.lists = Table('lists', M.mail_meta, autoload=True)
|
44 |
T.lists = Table('lists', M.mail_meta, autoload=True)
|
|
|
45 |
# TaskDB Tables
|
43 |
M.tables.ml_password_change = Table(
|
46 |
T.ml_password_change = Table(
|
44 |
'ml_password_change', M.task_meta, autoload=True)
|
47 |
'ml_password_change', M.task_meta, autoload=True)
|
|
|
48 |
# EpicDB Tables
|
|
|
49 |
T.backend_queue = Table('backend_queue', M.epic_meta, autoload=True)
|
|
|
50 |
T.object_metadata = Table('object_metadata', M.epic_meta, autoload=True)
|
|
|
51 |
T.feature_optin = Table('feature_optin', M.epic_meta, autoload=True)
|
|
|
52 |
T.feature_grouping = Table('feature_grouping', M.epic_meta, autoload=True)
|
|
|
53 |
T.sys_type_description = Table('sys_type_description', M.epic_meta, autoload=True)
|
45 |
|
54 |
|
46 |
def __call__(self, environ, start_response):
|
55 |
def __call__(self, environ, start_response):
|
47 |
request = Request(environ)
|
56 |
request = Request(environ)
|
48 |
try:
|
57 |
try:
|
49 |
self.handle(request)
|
58 |
self.handle(request)
|