<s> from __future__ import absolute_import <EOL> import logging <EOL> from tornado import web <EOL> from tornado import gen <EOL> from . . views import BaseHandler <EOL> from . . utils . broker import Broker <EOL> from . . api . control import ControlHandler <EOL> logger = logging . getLogger ( __name__ ) <EOL> class BrokerView ( BaseHandler ) : <EOL> @ web . authenticated <EOL> @ gen . coroutine <EOL> def get ( self ) : <EOL> app = self . application <EOL> broker_options = self . capp . conf . BROKER_TRANSPORT_OPTIONS <EOL> http_api = None <EOL> if app . transport == '<STR_LIT>' and app . options . broker_api : <EOL> http_api = app . options . broker_api <EOL> try : <EOL> broker = Broker ( app . capp . connection ( ) . as_uri ( include_password = True ) , <EOL> http_api = http_api , broker_options = broker_options ) <EOL> except NotImplementedError : <EOL> raise web . HTTPError ( <EOL> <NUM_LIT> , "<STR_LIT>" % app . transport ) <EOL> try : <EOL> queue_names = ControlHandler . get_active_queue_names ( ) <EOL> if not queue_names : <EOL> queue_names = set ( [ self . capp . conf . CELERY_DEFAULT_QUEUE ] ) <EOL> queues = yield broker . queues ( sorted ( queue_names ) ) <EOL> except Exception as e : <EOL> raise web . HTTPError ( <NUM_LIT> , "<STR_LIT>" % e ) <EOL> self . render ( "<STR_LIT>" , <EOL> broker_url = app . capp . connection ( ) . as_uri ( ) , <EOL> queues = queues ) </s>
