|
|
@@ -16,14 +16,10 @@
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
|
|
|
-from __future__ import print_function
|
|
|
import json
|
|
|
import logging
|
|
|
|
|
|
-from django.http import Http404
|
|
|
-from django.utils.html import escape
|
|
|
from django.utils.translation import ugettext as _
|
|
|
-from django.views.decorators.http import require_POST
|
|
|
|
|
|
from desktop.lib.django_util import JsonResponse
|
|
|
from desktop.lib.i18n import force_unicode
|
|
|
@@ -63,7 +59,9 @@ def error_handler(view_fn):
|
|
|
def list_topics(request):
|
|
|
return JsonResponse({
|
|
|
'status': 0,
|
|
|
- 'topics': [{'name': topic} for topic in get_topics()]
|
|
|
+ 'topics': [
|
|
|
+ {'name': topic} for topic in get_topics()
|
|
|
+ ]
|
|
|
})
|
|
|
|
|
|
|
|
|
@@ -106,7 +104,10 @@ def get_topics():
|
|
|
try:
|
|
|
manager = ManagerApi()
|
|
|
broker_host = manager.get_kafka_brokers().split(',')[0].split(':')[0]
|
|
|
- return [name for name in list(manager.get_kafka_topics(broker_host).keys()) if not name.startswith('__')]
|
|
|
+ return [
|
|
|
+ name
|
|
|
+ for name in list(manager.get_kafka_topics(broker_host).keys()) if not name.startswith('__')
|
|
|
+ ]
|
|
|
except Exception as e:
|
|
|
return ['user_behavior']
|
|
|
|