def edit_tab_handler(course_item, request):
 tab_id_locator = request.json['tab_id_locator']
 tab = get_tab_by_tab_id_locator(course_item.tabs, tab_id_locator)
 if (tab is None):
  return JsonResponse({'error': "Tab with id_locator '{0}' does not exist.".format(tab_id_locator)}, status=400)
 if ('is_hidden' in request.json):
  tab.is_hidden = request.json['is_hidden']
  modulestore().update_item(course_item, request.user.id)
 else:
  raise NotImplementedError('Unsupported request to edit tab: {0}'.format(request.json))
 return JsonResponse()

def edit_tab_handler ( course_item , request ) : tab_id_locator = request . json [ 'tab_id_locator' ] tab = get_tab_by_tab_id_locator ( course_item . tabs , tab_id_locator ) if ( tab is None ) : return JsonResponse ( { 'error' : "Tab with id_locator '{0}' does not exist." . format ( tab_id_locator ) } , status = 400 ) if ( 'is_hidden' in request . json ) : tab . is_hidden = request . json [ 'is_hidden' ] modulestore ( ) . update_item ( course_item , request . user . id ) else : raise NotImplementedError ( 'Unsupported request to edit tab: {0}' . format ( request . json ) ) return JsonResponse ( )
helper function for handling requests to edit settings of a single tab .