def add_edit_resources(context):
 request = context.get('request')
 if (not (request and could_edit(request) and may_inject(context))):
  return
 from ._theme import get_current_theme
 from .rendering import get_view_config
 view_config = get_view_config(context)
 theme = get_current_theme(request=request)
 if (not theme):
  return
 add_resource(context, 'body_end', InlineScriptResource.from_vars('XthemeEditorConfig', {'commandUrl': '/xtheme/', 'editUrl': '/xtheme/editor/', 'themeIdentifier': theme.identifier, 'viewName': view_config.view_name, 'edit': is_edit_mode(request), 'csrfToken': get_token(request)}))
 add_resource(context, 'body_end', staticfiles_storage.url('xtheme/editor-injection.js'))

def add_edit_resources ( context ) : request = context . get ( 'request' ) if ( not ( request and could_edit ( request ) and may_inject ( context ) ) ) : return from . _theme import get_current_theme from . rendering import get_view_config view_config = get_view_config ( context ) theme = get_current_theme ( request = request ) if ( not theme ) : return add_resource ( context , 'body_end' , InlineScriptResource . from_vars ( 'XthemeEditorConfig' , { 'commandUrl' : '/xtheme/' , 'editUrl' : '/xtheme/editor/' , 'themeIdentifier' : theme . identifier , 'viewName' : view_config . view_name , 'edit' : is_edit_mode ( request ) , 'csrfToken' : get_token ( request ) } ) ) add_resource ( context , 'body_end' , staticfiles_storage . url ( 'xtheme/editor-injection.js' ) )
possibly inject xtheme editor injection resources into the given contexts resources .