<s> import logging <EOL> from django . core . urlresolvers import reverse <EOL> from django . core . urlresolvers import reverse_lazy <EOL> from django import http <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> import django . views <EOL> from horizon import exceptions <EOL> from horizon import forms <EOL> from horizon import tables <EOL> from horizon import tabs <EOL> from openstack_dashboard . api import sahara as saharaclient <EOL> import openstack_dashboard . dashboards . project . data_processing . job_binaries . forms as job_binary_forms <EOL> from openstack_dashboard . dashboards . project . data_processing . job_binaries import tables as jb_tables <EOL> import openstack_dashboard . dashboards . project . data_processing . job_binaries . tabs as _tabs <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class JobBinariesView ( tables . DataTableView ) : <EOL> table_class = jb_tables . JobBinariesTable <EOL> template_name = '<STR_LIT>' <EOL> def get_data ( self ) : <EOL> try : <EOL> job_binaries = saharaclient . job_binary_list ( self . request ) <EOL> except Exception : <EOL> job_binaries = [ ] <EOL> exceptions . handle ( self . request , <EOL> _ ( "<STR_LIT>" ) ) <EOL> return job_binaries <EOL> class CreateJobBinaryView ( forms . ModalFormView ) : <EOL> form_class = job_binary_forms . JobBinaryCreateForm <EOL> success_url = reverse_lazy ( <EOL> '<STR_LIT>' ) <EOL> classes = ( "<STR_LIT>" ) <EOL> template_name = "<STR_LIT>" <EOL> class JobBinaryDetailsView ( tabs . TabView ) : <EOL> tab_group_class = _tabs . JobBinaryDetailsTabs <EOL> template_name = '<STR_LIT>' <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( JobBinaryDetailsView , self ) . get_context_data ( ** kwargs ) <EOL> return context <EOL> def get_data ( self ) : <EOL> pass <EOL> class DownloadJobBinaryView ( django . views . generic . View ) : <EOL> def get ( self , request , job_binary_id = None ) : <EOL> try : <EOL> jb = saharaclient . job_binary_get ( request , job_binary_id ) <EOL> data = saharaclient . job_binary_get_file ( request , job_binary_id ) <EOL> except Exception : <EOL> redirect = reverse ( <EOL> '<STR_LIT>' ) <EOL> exceptions . handle ( self . request , <EOL> _ ( '<STR_LIT>' ) , <EOL> redirect = redirect ) <EOL> response = http . HttpResponse ( content_type = '<STR_LIT>' ) <EOL> response [ '<STR_LIT>' ] = ( <EOL> '<STR_LIT>' % jb . name ) <EOL> response . write ( data ) <EOL> response [ '<STR_LIT>' ] = str ( len ( data ) ) <EOL> return response </s>
