<s> import logging <EOL> from horizon import browsers <EOL> from horizon import workflows <EOL> import workflows . create as configure_workflow <EOL> import workflows . update_job as update_job_workflow <EOL> import workflows . update_actions as update_actions_workflow <EOL> import disaster_recovery . api . api as freezer_api <EOL> import disaster_recovery . jobs . browsers as project_browsers <EOL> from disaster_recovery . utils import shield <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class JobsView ( browsers . ResourceBrowserView ) : <EOL> browser_class = project_browsers . ContainerBrowser <EOL> template_name = "<STR_LIT>" <EOL> @ shield ( "<STR_LIT>" , redirect = '<STR_LIT>' ) <EOL> def get_jobs_data ( self ) : <EOL> return freezer_api . Job ( self . request ) . list ( limit = <NUM_LIT:100> ) <EOL> @ shield ( "<STR_LIT>" , redirect = '<STR_LIT>' ) <EOL> def get_actions_in_job_data ( self ) : <EOL> if self . kwargs [ '<STR_LIT>' ] : <EOL> return freezer_api . Job ( self . request ) . actions ( self . kwargs [ '<STR_LIT>' ] ) <EOL> return [ ] <EOL> class JobWorkflowView ( workflows . WorkflowView ) : <EOL> workflow_class = configure_workflow . ConfigureJob <EOL> @ shield ( "<STR_LIT>" , redirect = "<STR_LIT>" ) <EOL> def get_object ( self ) : <EOL> return freezer_api . Job ( self . request ) . get ( self . kwargs [ '<STR_LIT>' ] ) <EOL> def is_update ( self ) : <EOL> return '<STR_LIT>' in self . kwargs and bool ( self . kwargs [ '<STR_LIT>' ] ) <EOL> @ shield ( "<STR_LIT>" , redirect = "<STR_LIT>" ) <EOL> def get_initial ( self ) : <EOL> initial = super ( JobWorkflowView , self ) . get_initial ( ) <EOL> if self . is_update ( ) : <EOL> initial . update ( { '<STR_LIT>' : None } ) <EOL> job = freezer_api . Job ( self . request ) . get ( self . kwargs [ '<STR_LIT>' ] , <EOL> json = True ) <EOL> initial . update ( ** job ) <EOL> initial . update ( ** job [ '<STR_LIT>' ] ) <EOL> return initial <EOL> class EditJobWorkflowView ( workflows . WorkflowView ) : <EOL> workflow_class = update_job_workflow . UpdateJob <EOL> @ shield ( "<STR_LIT>" , redirect = "<STR_LIT>" ) <EOL> def get_object ( self ) : <EOL> return freezer_api . Job ( self . request ) . get ( self . kwargs [ '<STR_LIT>' ] ) <EOL> def is_update ( self ) : <EOL> return '<STR_LIT>' in self . kwargs and bool ( self . kwargs [ '<STR_LIT>' ] ) <EOL> @ shield ( "<STR_LIT>" , redirect = "<STR_LIT>" ) <EOL> def get_initial ( self ) : <EOL> initial = super ( EditJobWorkflowView , self ) . get_initial ( ) <EOL> if self . is_update ( ) : <EOL> initial . update ( { '<STR_LIT>' : None } ) <EOL> job = freezer_api . Job ( self . request ) . get ( self . kwargs [ '<STR_LIT>' ] , <EOL> json = True ) <EOL> initial . update ( ** job ) <EOL> initial . update ( ** job [ '<STR_LIT>' ] ) <EOL> return initial <EOL> class ActionsInJobView ( workflows . WorkflowView ) : <EOL> workflow_class = update_actions_workflow . UpdateActions <EOL> @ shield ( "<STR_LIT>" , redirect = "<STR_LIT>" ) <EOL> def get_object ( self ) : <EOL> return freezer_api . Job ( self . request ) . get ( self . kwargs [ '<STR_LIT>' ] ) <EOL> def is_update ( self ) : <EOL> return '<STR_LIT>' in self . kwargs and bool ( self . kwargs [ '<STR_LIT>' ] ) <EOL> @ shield ( "<STR_LIT>" , redirect = "<STR_LIT>" ) <EOL> def get_initial ( self ) : <EOL> initial = super ( ActionsInJobView , self ) . get_initial ( ) <EOL> if self . is_update ( ) : <EOL> job = freezer_api . Job ( self . request ) . get ( self . kwargs [ '<STR_LIT>' ] ) <EOL> initial . update ( { '<STR_LIT>' : job . id } ) <EOL> return initial </s>
