python 2.7 - Passing variable to Pyramid controller -


i have queues initiated in topmost part of hierarchy of webapp.

from main entry point, put 1 of queues in worker thread , want pass same queue pyramid controller can communicate.

this main entry point spins threads , pyramid:

def main(global_config, **settings):     sql_session = initialize_sql()     session_factory = signedcookiesessionfactory(''.join(random.choice(string.printable) in range(64)),                                                  secure=true,                                                  httponly=true)      queues = namedtuple('queues', 'db requests_from_proxy requests_to_proxy responses')     queue = queues(queue(), queue(), queue(), queue())      config = configurator(settings=settings)     config.include("cornice")     config.scan("fart.controller")     config.set_session_factory(session_factory)     config.my_queue = queue      proxy_thread = thread(target=init_proxy, args=(queue, config,))     db_thread = thread(target=init_worker, args=(queue, sql_session,))     proxy_thread.start()     db_thread.start()      return config.make_wsgi_app() 

here controller:

""" cornice services. """ cornice import service import json   request_service = service(name='request', path='/api/request')  @request_service.get() def get_request(request):     print dir()     return json.dumps(queue.requests_from_proxy.get()) 

i've spent hours looking @ documentation , examples cannot figure out how make queue initiated in main entry point accessible controller. ideas?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -