channelstream: use proper pyramid event to create storage on app creation.

This commit is contained in:
Marcin Kuzminski 2017-11-06 18:51:57 +01:00
parent f81094ddef
commit 0e8f210866

View file

@ -20,6 +20,7 @@
import os
from pyramid.events import ApplicationCreated
from pyramid.settings import asbool
from rhodecode.config.routing import ADMIN_PREFIX
@ -57,6 +58,14 @@ PLUGIN_DEFINITION = {
}
def maybe_create_history_store(event):
# create plugin history location
settings = event.app.registry.settings
history_dir = settings.get('channelstream.history.location', '')
if history_dir and not os.path.exists(history_dir):
os.makedirs(history_dir, 0750)
def includeme(config):
settings = config.registry.settings
PLUGIN_DEFINITION['config']['enabled'] = asbool(
@ -71,10 +80,7 @@ def includeme(config):
PLUGIN_DEFINITION['name'],
PLUGIN_DEFINITION['config']
)
# create plugin history location
history_dir = PLUGIN_DEFINITION['config']['history.location']
if history_dir and not os.path.exists(history_dir):
os.makedirs(history_dir, 0750)
config.add_subscriber(maybe_create_history_store, ApplicationCreated)
config.add_route(
name='channelstream_connect',