<s> import logging <EOL> from flask import ( <EOL> flash , redirect , send_file , jsonify , make_response , url_for , session , abort ) <EOL> from . _compat import as_unicode <EOL> from . filemanager import uuid_originalname <EOL> from . widgets import GroupFormListWidget , ListMasterWidget <EOL> from . baseviews import BaseView , BaseCRUDView , BaseFormView , expose , expose_api <EOL> from . security . decorators import has_access , permission_name , has_access_api <EOL> from . urltools import * <EOL> from . const import FLAMSG_ERR_SEC_ACCESS_DENIED <EOL> log = logging . getLogger ( __name__ ) <EOL> class IndexView ( BaseView ) : <EOL> """<STR_LIT>""" <EOL> route_base = '<STR_LIT>' <EOL> default_view = '<STR_LIT:index>' <EOL> index_template = '<STR_LIT>' <EOL> @ expose ( '<STR_LIT:/>' ) <EOL> def index ( self ) : <EOL> self . update_redirect ( ) <EOL> return self . render_template ( self . index_template , <EOL> appbuilder = self . appbuilder ) <EOL> class UtilView ( BaseView ) : <EOL> """<STR_LIT>""" <EOL> route_base = '<STR_LIT>' <EOL> default_view = '<STR_LIT>' <EOL> @ expose ( '<STR_LIT>' ) <EOL> def back ( self ) : <EOL> return redirect ( self . get_redirect ( ) ) <EOL> class SimpleFormView ( BaseFormView ) : <EOL> """<STR_LIT>""" <EOL> @ expose ( "<STR_LIT>" , methods = [ '<STR_LIT:GET>' ] ) <EOL> @ has_access <EOL> def this_form_get ( self ) : <EOL> self . _init_vars ( ) <EOL> form = self . form . refresh ( ) <EOL> self . form_get ( form ) <EOL> widgets = self . _get_edit_widget ( form = form ) <EOL> self . update_redirect ( ) <EOL> return self . render_template ( self . form_template , <EOL> title = self . form_title , <EOL> widgets = widgets , <EOL> appbuilder = self . appbuilder <EOL> ) <EOL> @ expose ( "<STR_LIT>" , methods = [ '<STR_LIT:POST>' ] ) <EOL> @ has_access <EOL> def this_form_post ( self ) : <EOL> self . _init_vars ( ) <EOL> form = self . form . refresh ( ) <EOL> if form . validate_on_submit ( ) : <EOL> response = self . form_post ( form ) <EOL> if not response : <EOL> return redirect ( self . get_redirect ( ) ) <EOL> return response <EOL> else : <EOL> widgets = self . _get_edit_widget ( form = form ) <EOL> return self . render_template ( <EOL> self . form_template , <EOL> title = self . form_title , <EOL> widgets = widgets , <EOL> appbuilder = self . appbuilder <EOL> ) <EOL> class PublicFormView ( BaseFormView ) : <EOL> """<STR_LIT>""" <EOL> @ expose ( "<STR_LIT>" , methods = [ '<STR_LIT:GET>' ] ) <EOL> def this_form_get ( self ) : <EOL> self . _init_vars ( ) <EOL> form = self . form . refresh ( ) <EOL> self . form_get ( form ) <EOL> widgets = self . _get_edit_widget ( form = form ) <EOL> self . update_redirect ( ) <EOL> return self . render_template ( self . form_template , <EOL> title = self . form_title , <EOL> widgets = widgets , <EOL> appbuilder = self . appbuilder <EOL> ) <EOL> @ expose ( "<STR_LIT>" , methods = [ '<STR_LIT:POST>' ] ) <EOL> def this_form_post ( self ) : <EOL> self . _init_vars ( ) <EOL> form = self . form . refresh ( ) <EOL> if form . validate_on_submit ( ) : <EOL> response = self . form_post ( form ) <EOL> if not response : <EOL> return redirect ( self . get_redirect ( ) ) <EOL> return response <EOL> else : <EOL> widgets = self . _get_edit_widget ( form = form ) <EOL> return self . render_template ( <EOL> self . form_template , <EOL> title = self . form_title , <EOL> widgets = widgets , <EOL> appbuilder = self . appbuilder <EOL> ) <EOL> class RestCRUDView ( BaseCRUDView ) : <EOL> """<STR_LIT>""" <EOL> def _search_form_json ( self ) : <EOL> pass <EOL> def _get_api_urls ( self , api_urls = None ) : <EOL> """<STR_LIT>""" <EOL> view_name = self . __class__ . __name__ <EOL> api_urls = api_urls or { } <EOL> api_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" ) <EOL> api_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" , pk = "<STR_LIT>" ) <EOL> api_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" ) <EOL> api_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" , pk = "<STR_LIT>" ) <EOL> return api_urls <EOL> def _get_modelview_urls ( self , modelview_urls = None ) : <EOL> view_name = self . __class__ . __name__ <EOL> modelview_urls = modelview_urls or { } <EOL> modelview_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" , pk = "<STR_LIT>" ) <EOL> modelview_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" ) <EOL> modelview_urls [ '<STR_LIT>' ] = url_for ( view_name + "<STR_LIT>" , pk = "<STR_LIT>" ) <EOL> return modelview_urls <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' ] ) <EOL> @ has_access_api <EOL> @ permission_name ( '<STR_LIT:list>' ) <EOL> def api ( self ) : <EOL> view_name = self . __class__ . __name__ <EOL> api_urls = self . _get_api_urls ( ) <EOL> modelview_urls = self . _get_modelview_urls ( ) <EOL> can_show = self . appbuilder . sm . has_access ( '<STR_LIT>' , view_name ) <EOL> can_edit = self . appbuilder . sm . has_access ( '<STR_LIT>' , view_name ) <EOL> can_add = self . appbuilder . sm . has_access ( '<STR_LIT>' , view_name ) <EOL> can_delete = self . appbuilder . sm . has_access ( '<STR_LIT>' , view_name ) <EOL> form_fields = { } <EOL> search_filters = { } <EOL> dict_filters = self . _filters . get_search_filters ( ) <EOL> form = self . search_form . refresh ( ) <EOL> for col in self . search_columns : <EOL> form_fields [ col ] = form [ col ] ( ) <EOL> search_filters [ col ] = [ as_unicode ( flt . name ) for flt in dict_filters [ col ] ] <EOL> ret_json = jsonify ( can_show = can_show , <EOL> can_add = can_add , <EOL> can_edit = can_edit , <EOL> can_delete = can_delete , <EOL> label_columns = self . _label_columns_json ( ) , <EOL> list_columns = self . list_columns , <EOL> order_columns = self . order_columns , <EOL> page_size = self . page_size , <EOL> modelview_name = view_name , <EOL> api_urls = api_urls , <EOL> search_filters = search_filters , <EOL> search_fields = form_fields , <EOL> modelview_urls = modelview_urls ) <EOL> response = make_response ( ret_json , <NUM_LIT:200> ) <EOL> response . headers [ '<STR_LIT:Content-Type>' ] = "<STR_LIT:application/json>" <EOL> return response <EOL> @ expose_api ( name = '<STR_LIT>' , url = '<STR_LIT>' , methods = [ '<STR_LIT:GET>' ] ) <EOL> @ has_access_api <EOL> @ permission_name ( '<STR_LIT:list>' ) <EOL> def api_read ( self ) : <EOL> """<STR_LIT:U+0020>""" <EOL> if get_order_args ( ) . get ( self . __class__ . __name__ ) : <EOL> order_column , order_direction = get_order_args ( ) . get ( self . __class__ . __name__ ) <EOL> else : <EOL> order_column , order_direction = '<STR_LIT>' , '<STR_LIT>' <EOL> page = get_page_args ( ) . get ( self . __class__ . __name__ ) <EOL> page_size = get_page_size_args ( ) . get ( self . __class__ . __name__ ) <EOL> get_filter_args ( self . _filters ) <EOL> joined_filters = self . _filters . get_joined_filters ( self . _base_filters ) <EOL> count , lst = self . datamodel . query ( joined_filters , order_column , order_direction , page = page , page_size = page_size ) <EOL> result = self . datamodel . get_values_json ( lst , self . list_columns ) <EOL> pks = self . datamodel . get_keys ( lst ) <EOL> ret_json = jsonify ( label_columns = self . _label_columns_json ( ) , <EOL> list_columns = self . list_columns , <EOL> order_columns = self . order_columns , <EOL> page = page , <EOL> page_size = page_size , <EOL> count = count , <EOL> modelview_name = self . __class__ . __name__ , <EOL> pks = pks , <EOL> result = result ) <EOL> response = make_response ( ret_json , <NUM_LIT:200> ) <EOL> response . headers [ '<STR_LIT:Content-Type>' ] = "<STR_LIT:application/json>" <EOL> return response <EOL> @ expose_api ( name = '<STR_LIT>' , url = '<STR_LIT>' , methods = [ '<STR_LIT:POST>' ] ) <EOL> @ has_access_api <EOL> @ permission_name ( '<STR_LIT>' ) <EOL> def api_create ( self ) : <EOL> is_valid_form = True <EOL> get_filter_args ( self . _filters ) <EOL> exclude_cols = self . _filters . get_relation_cols ( ) <EOL> form = self . add_form . refresh ( ) <EOL> self . _fill_form_exclude_cols ( exclude_cols , form ) <EOL> if form . validate ( ) : <EOL> item = self . datamodel . obj ( ) <EOL> form . populate_obj ( item ) <EOL> self . pre_add ( item ) <EOL> if self . datamodel . add ( item ) : <EOL> self . post_add ( item ) <EOL> http_return_code = <NUM_LIT:200> <EOL> else : <EOL> http_return_code = <NUM_LIT> <EOL> else : <EOL> is_valid_form = False <EOL> if is_valid_form : <EOL> response = make_response ( jsonify ( { '<STR_LIT:message>' : self . datamodel . message [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : self . datamodel . message [ <NUM_LIT:1> ] } ) , http_return_code ) <EOL> else : <EOL> response = make_response ( jsonify ( { '<STR_LIT:message>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) , <NUM_LIT> ) <EOL> return response <EOL> @ expose_api ( name = '<STR_LIT>' , url = '<STR_LIT>' , methods = [ '<STR_LIT>' ] ) <EOL> @ has_access_api <EOL> @ permission_name ( '<STR_LIT>' ) <EOL> def api_update ( self , pk ) : <EOL> is_valid_form = True <EOL> get_filter_args ( self . _filters ) <EOL> exclude_cols = self . _filters . get_relation_cols ( ) <EOL> item = self . datamodel . get ( pk , self . _base_filters ) <EOL> if not item : <EOL> abort ( <NUM_LIT> ) <EOL> pk = self . datamodel . get_pk_value ( item ) <EOL> form = self . edit_form . refresh ( request . form ) <EOL> self . _fill_form_exclude_cols ( exclude_cols , form ) <EOL> form . _id = pk <EOL> if form . validate ( ) : <EOL> form . populate_obj ( item ) <EOL> self . pre_update ( item ) <EOL> if self . datamodel . edit ( item ) : <EOL> self . post_update ( item ) <EOL> http_return_code = <NUM_LIT:200> <EOL> else : <EOL> http_return_code = <NUM_LIT> <EOL> else : <EOL> is_valid_form = False <EOL> if is_valid_form : <EOL> response = make_response ( jsonify ( { '<STR_LIT:message>' : self . datamodel . message [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : self . datamodel . message [ <NUM_LIT:1> ] } ) , http_return_code ) <EOL> else : <EOL> response = make_response ( jsonify ( { '<STR_LIT:message>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) , <NUM_LIT> ) <EOL> return response <EOL> @ expose_api ( name = '<STR_LIT>' , url = '<STR_LIT>' , methods = [ '<STR_LIT>' ] ) <EOL> @ has_access_api <EOL> @ permission_name ( '<STR_LIT>' ) <EOL> def api_delete ( self , pk ) : <EOL> item = self . datamodel . get ( pk , self . _base_filters ) <EOL> if not item : <EOL> abort ( <NUM_LIT> ) <EOL> self . pre_delete ( item ) <EOL> if self . datamodel . delete ( item ) : <EOL> self . post_delete ( item ) <EOL> http_return_code = <NUM_LIT:200> <EOL> else : <EOL> http_return_code = <NUM_LIT> <EOL> response = make_response ( jsonify ( { '<STR_LIT:message>' : self . datamodel . message [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : self . datamodel . message [ <NUM_LIT:1> ] } ) , http_return_code ) <EOL> response . headers [ '<STR_LIT:Content-Type>' ] = "<STR_LIT:application/json>" <EOL> return response <EOL> @ expose_api ( name = '<STR_LIT>' , url = '<STR_LIT>' , methods = [ '<STR_LIT:GET>' ] ) <EOL> @ has_access_api <EOL> @ permission_name ( '<STR_LIT:list>' ) <EOL> def api_column ( self , col_name ) : <EOL> filter_rel_fields = self . add_form_query_rel_fields <EOL> if filter_rel_fields and filter_rel_fields . get ( col_name ) : <EOL> datamodel = self . datamodel . get_related_interface ( col_name ) <EOL> filters = datamodel . get_filters ( ) . add_filter_list ( filter_rel_fields [ col_name ] ) <EOL> result = datamodel . query ( filters ) [ <NUM_LIT:1> ] <EOL> else : <EOL> result = self . datamodel . get_related_interface ( col_name ) . query ( ) [ <NUM_LIT:1> ] <EOL> ret_json = dict ( ) <EOL> for item in result : <EOL> pk = self . datamodel . get_related_interface ( col_name ) . get_pk_value ( item ) <EOL> ret_json [ pk ] = str ( item ) <EOL> ret_json = jsonify ( ret_json ) <EOL> response = make_response ( ret_json , <NUM_LIT:200> ) <EOL> response . headers [ '<STR_LIT:Content-Type>' ] = "<STR_LIT:application/json>" <EOL> return response <EOL> class ModelView ( RestCRUDView ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , ** kwargs ) : <EOL> super ( ModelView , self ) . __init__ ( ** kwargs ) <EOL> """<STR_LIT>""" <EOL> @ expose ( '<STR_LIT>' ) <EOL> @ has_access <EOL> def list ( self ) : <EOL> widgets = self . _list ( ) <EOL> return self . render_template ( self . list_template , <EOL> title = self . list_title , <EOL> widgets = widgets ) <EOL> """<STR_LIT>""" <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' ] ) <EOL> @ has_access <EOL> def show ( self , pk ) : <EOL> widgets = self . _show ( pk ) <EOL> return self . render_template ( self . show_template , <EOL> pk = pk , <EOL> title = self . show_title , <EOL> widgets = widgets , <EOL> related_views = self . _related_views ) <EOL> """<STR_LIT>""" <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ has_access <EOL> def add ( self ) : <EOL> widget = self . _add ( ) <EOL> if not widget : <EOL> return redirect ( self . get_redirect ( ) ) <EOL> else : <EOL> return self . render_template ( self . add_template , <EOL> title = self . add_title , <EOL> widgets = widget ) <EOL> """<STR_LIT>""" <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ has_access <EOL> def edit ( self , pk ) : <EOL> widgets = self . _edit ( pk ) <EOL> if not widgets : <EOL> return redirect ( self . get_redirect ( ) ) <EOL> else : <EOL> return self . render_template ( self . edit_template , <EOL> title = self . edit_title , <EOL> widgets = widgets , <EOL> related_views = self . _related_views ) <EOL> """<STR_LIT>""" <EOL> @ expose ( '<STR_LIT>' ) <EOL> @ has_access <EOL> def delete ( self , pk ) : <EOL> self . _delete ( pk ) <EOL> return redirect ( self . get_redirect ( ) ) <EOL> @ expose ( '<STR_LIT>' ) <EOL> @ has_access <EOL> def download ( self , filename ) : <EOL> return send_file ( self . appbuilder . app . config [ '<STR_LIT>' ] + filename , <EOL> attachment_filename = uuid_originalname ( filename ) , <EOL> as_attachment = True ) <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' ] ) <EOL> def action ( self , name , pk ) : <EOL> """<STR_LIT>""" <EOL> if self . appbuilder . sm . has_access ( name , self . __class__ . __name__ ) : <EOL> action = self . actions . get ( name ) <EOL> return action . func ( self . datamodel . get ( pk ) ) <EOL> else : <EOL> flash ( as_unicode ( FLAMSG_ERR_SEC_ACCESS_DENIED ) , "<STR_LIT>" ) <EOL> return redirect ( '<STR_LIT:.>' ) <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:POST>' ] ) <EOL> def action_post ( self ) : <EOL> """<STR_LIT>""" <EOL> name = request . form [ '<STR_LIT:action>' ] <EOL> pks = request . form . getlist ( '<STR_LIT>' ) <EOL> if self . appbuilder . sm . has_access ( name , self . __class__ . __name__ ) : <EOL> action = self . actions . get ( name ) <EOL> items = [ self . datamodel . get ( pk ) for pk in pks ] <EOL> return action . func ( items ) <EOL> else : <EOL> flash ( as_unicode ( FLAMSG_ERR_SEC_ACCESS_DENIED ) , "<STR_LIT>" ) <EOL> return redirect ( '<STR_LIT:.>' ) <EOL> class MasterDetailView ( BaseCRUDView ) : <EOL> """<STR_LIT>""" <EOL> list_template = '<STR_LIT>' <EOL> list_widget = ListMasterWidget <EOL> master_div_width = <NUM_LIT:2> <EOL> """<STR_LIT>""" <EOL> @ expose ( '<STR_LIT>' ) <EOL> @ expose ( '<STR_LIT>' ) <EOL> @ has_access <EOL> def list ( self , pk = None ) : <EOL> pages = get_page_args ( ) <EOL> page_sizes = get_page_size_args ( ) <EOL> orders = get_order_args ( ) <EOL> widgets = self . _list ( ) <EOL> if pk : <EOL> item = self . datamodel . get ( pk ) <EOL> widgets = self . _get_related_views_widgets ( item , orders = orders , <EOL> pages = pages , page_sizes = page_sizes , widgets = widgets ) <EOL> related_views = self . _related_views <EOL> else : <EOL> related_views = [ ] <EOL> return self . render_template ( self . list_template , <EOL> title = self . list_title , <EOL> widgets = widgets , <EOL> related_views = related_views , <EOL> master_div_width = self . master_div_width ) <EOL> class MultipleView ( BaseView ) : <EOL> """<STR_LIT>""" <EOL> list_template = '<STR_LIT>' <EOL> """<STR_LIT>""" <EOL> views = None <EOL> "<STR_LIT>" <EOL> _views = None <EOL> def __init__ ( self , ** kwargs ) : <EOL> super ( MultipleView , self ) . __init__ ( ** kwargs ) <EOL> self . views = self . views or list ( ) <EOL> self . _views = self . _views or list ( ) <EOL> def get_uninit_inner_views ( self ) : <EOL> return self . views <EOL> def get_init_inner_views ( self ) : <EOL> return self . _views <EOL> @ expose ( '<STR_LIT>' ) <EOL> @ has_access <EOL> def list ( self ) : <EOL> pages = get_page_args ( ) <EOL> page_sizes = get_page_size_args ( ) <EOL> orders = get_order_args ( ) <EOL> views_widgets = list ( ) <EOL> for view in self . _views : <EOL> if orders . get ( view . __class__ . __name__ ) : <EOL> order_column , order_direction = orders . get ( view . __class__ . __name__ ) <EOL> else : <EOL> order_column , order_direction = '<STR_LIT>' , '<STR_LIT>' <EOL> page = pages . get ( view . __class__ . __name__ ) <EOL> page_size = page_sizes . get ( view . __class__ . __name__ ) <EOL> views_widgets . append ( view . _get_view_widget ( filters = view . _base_filters , <EOL> order_column = order_column , <EOL> order_direction = order_direction , <EOL> page = page , page_size = page_size ) ) <EOL> self . update_redirect ( ) <EOL> return self . render_template ( self . list_template , <EOL> views = self . _views , <EOL> views_widgets = views_widgets ) <EOL> class CompactCRUDMixin ( BaseCRUDView ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def set_key ( cls , k , v ) : <EOL> """<STR_LIT>""" <EOL> k = cls . __name__ + '<STR_LIT>' + k <EOL> session [ k ] = v <EOL> @ classmethod <EOL> def get_key ( cls , k , default = None ) : <EOL> """<STR_LIT>""" <EOL> k = cls . __name__ + '<STR_LIT>' + k <EOL> if k in session : <EOL> return session [ k ] <EOL> else : <EOL> return default <EOL> def _get_list_widget ( self , ** args ) : <EOL> """<STR_LIT>""" <EOL> widgets = super ( CompactCRUDMixin , self ) . _get_list_widget ( ** args ) <EOL> session_form_widget = self . get_key ( '<STR_LIT>' , None ) <EOL> form_widget = None <EOL> if session_form_widget == '<STR_LIT>' : <EOL> form_widget = self . _add ( ) . get ( '<STR_LIT>' ) <EOL> elif session_form_widget == '<STR_LIT>' : <EOL> pk = self . get_key ( '<STR_LIT>' ) <EOL> if pk : <EOL> form_widget = self . _edit ( int ( pk ) ) . get ( '<STR_LIT>' ) <EOL> return { <EOL> '<STR_LIT:list>' : GroupFormListWidget ( <EOL> list_widget = widgets . get ( '<STR_LIT:list>' ) , <EOL> form_widget = form_widget , <EOL> form_action = self . get_key ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> form_title = self . get_key ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ) <EOL> } <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ has_access <EOL> def list ( self ) : <EOL> list_widgets = self . _list ( ) <EOL> return self . render_template ( self . list_template , <EOL> title = self . list_title , <EOL> widgets = list_widgets ) <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ has_access <EOL> def add ( self ) : <EOL> widgets = self . _add ( ) <EOL> if not widgets : <EOL> self . set_key ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_key ( '<STR_LIT>' , None ) <EOL> return redirect ( request . referrer ) <EOL> else : <EOL> self . set_key ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_key ( '<STR_LIT>' , request . full_path ) <EOL> self . set_key ( '<STR_LIT>' , self . add_title ) <EOL> return redirect ( self . get_redirect ( ) ) <EOL> @ expose ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ has_access <EOL> def edit ( self , pk ) : <EOL> widgets = self . _edit ( pk ) <EOL> if not widgets : <EOL> self . set_key ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_key ( '<STR_LIT>' , None ) <EOL> return redirect ( self . get_redirect ( ) ) <EOL> else : <EOL> self . set_key ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_key ( '<STR_LIT>' , request . full_path ) <EOL> self . set_key ( '<STR_LIT>' , self . add_title ) <EOL> self . set_key ( '<STR_LIT>' , pk ) <EOL> return redirect ( self . get_redirect ( ) ) <EOL> """<STR_LIT>""" <EOL> GeneralView = ModelView </s>
