def _refresh_course_tabs(request, course_module):
 def update_tab(tabs, tab_type, tab_enabled):
  '\n        Adds or removes a course tab based upon whether it is enabled.\n        '
  tab_panel = {'type': tab_type.type}
  has_tab = (tab_panel in tabs)
  if (tab_enabled and (not has_tab)):
   tabs.append(CourseTab.from_json(tab_panel))
  elif ((not tab_enabled) and has_tab):
   tabs.remove(tab_panel)
 course_tabs = copy.copy(course_module.tabs)
 for tab_type in CourseTabPluginManager.get_tab_types():
  if ((not tab_type.is_dynamic) and tab_type.is_default):
   tab_enabled = tab_type.is_enabled(course_module, user=request.user)
   update_tab(course_tabs, tab_type, tab_enabled)
 CourseTabList.validate_tabs(course_tabs)
 if (course_tabs != course_module.tabs):
  course_module.tabs = course_tabs

def _refresh_course_tabs ( request , course_module ) : def update_tab ( tabs , tab_type , tab_enabled ) : tab_panel = { 'type' : tab_type . type } has_tab = ( tab_panel in tabs ) if ( tab_enabled and ( not has_tab ) ) : tabs . append ( CourseTab . from_json ( tab_panel ) ) elif ( ( not tab_enabled ) and has_tab ) : tabs . remove ( tab_panel ) course_tabs = copy . copy ( course_module . tabs ) for tab_type in CourseTabPluginManager . get_tab_types ( ) : if ( ( not tab_type . is_dynamic ) and tab_type . is_default ) : tab_enabled = tab_type . is_enabled ( course_module , user = request . user ) update_tab ( course_tabs , tab_type , tab_enabled ) CourseTabList . validate_tabs ( course_tabs ) if ( course_tabs != course_module . tabs ) : course_module . tabs = course_tabs
automatically adds/removes tabs if changes to the course require them .