def find_media_source(url):
 while (url[0] == '/'):
  url = url[1:]
 d = os.path.dirname
 n = os.path.normpath
 j = os.path.join
 f = os.path.isfile
 skins = n(j(d(d(__file__)), 'skins'))
 try:
  media = os.path.join(skins, settings.OSQA_DEFAULT_SKIN, url)
  assert f(media)
  use_skin = settings.OSQA_DEFAULT_SKIN
 except:
  try:
   media = j(skins, 'default', url)
   assert f(media)
   use_skin = 'default'
  except:
   media = j(skins, 'common', url)
   try:
    assert f(media)
    use_skin = 'common'
   except:
    logging.error(('could not find media for %s' % url))
    use_skin = ''
    return None
 return ((use_skin + '/') + url)

def find_media_source ( url ) : while ( url [ 0 ] == '/' ) : url = url [ 1 : ] d = os . path . dirname n = os . path . normpath j = os . path . join f = os . path . isfile skins = n ( j ( d ( d ( __file__ ) ) , 'skins' ) ) try : media = os . path . join ( skins , settings . OSQA_DEFAULT_SKIN , url ) assert f ( media ) use_skin = settings . OSQA_DEFAULT_SKIN except : try : media = j ( skins , 'default' , url ) assert f ( media ) use_skin = 'default' except : media = j ( skins , 'common' , url ) try : assert f ( media ) use_skin = 'common' except : logging . error ( ( 'could not find media for %s' % url ) ) use_skin = '' return None return ( ( use_skin + '/' ) + url )
returns url prefixed with the skin name of the first skin that contains the file directories are searched in this order: settings .