def Web_Template(key, defweb, wdir):
 if (wdir is None):
  try:
   wdir = fix_webname(key())
  except:
   wdir = ''
 if (not wdir):
  wdir = defweb
 if key:
  key.set(wdir)
 if (not wdir):
  return ''
 full_dir = real_path(sabnzbd.DIR_INTERFACES, wdir)
 full_main = real_path(full_dir, DEF_MAIN_TMPL)
 logging.info('Web dir is %s', full_dir)
 if (not os.path.exists(full_main)):
  if (defweb == DEF_STDCONFIG):
   return ''
  logging.warning(T('Cannot find web template: %s, trying standard template'), full_main)
  full_dir = real_path(sabnzbd.DIR_INTERFACES, DEF_STDINTF)
  full_main = real_path(full_dir, DEF_MAIN_TMPL)
  if (not os.path.exists(full_main)):
   logging.exception('Cannot find standard template: %s', full_dir)
   panic_tmpl(full_dir)
   exit_sab(1)
 return real_path(full_dir, 'templates')

def Web_Template ( key , defweb , wdir ) : if ( wdir is None ) : try : wdir = fix_webname ( key ( ) ) except : wdir = '' if ( not wdir ) : wdir = defweb if key : key . set ( wdir ) if ( not wdir ) : return '' full_dir = real_path ( sabnzbd . DIR_INTERFACES , wdir ) full_main = real_path ( full_dir , DEF_MAIN_TMPL ) logging . info ( 'Web dir is %s' , full_dir ) if ( not os . path . exists ( full_main ) ) : if ( defweb == DEF_STDCONFIG ) : return '' logging . warning ( T ( 'Cannot find web template: %s, trying standard template' ) , full_main ) full_dir = real_path ( sabnzbd . DIR_INTERFACES , DEF_STDINTF ) full_main = real_path ( full_dir , DEF_MAIN_TMPL ) if ( not os . path . exists ( full_main ) ) : logging . exception ( 'Cannot find standard template: %s' , full_dir ) panic_tmpl ( full_dir ) exit_sab ( 1 ) return real_path ( full_dir , 'templates' )
determine a correct web template set .