@contextfunction
def core_logo_content(context, gif=False):
 staticpath = getattr(settings, 'STATIC_DOC_ROOT', './static')
 logopath = (staticpath + '/logo')
 if gif:
  logopath += '.gif'
  mimetype = 'image/gif'
 else:
  logopath += '.png'
  mimetype = 'image/png'
 customlogo = ''
 try:
  conf = ModuleSetting.get_for_module('treeio.core', 'logopath')[0]
  customlogo = (getattr(settings, 'MEDIA_ROOT', './static/media') + conf.value)
 except:
  pass
 logofile = ''
 if customlogo:
  try:
   logofile = open(customlogo, 'r')
  except:
   pass
 if (not logofile):
  try:
   logofile = open(logopath, 'r')
  except:
   pass
 result = ((('data:' + mimetype) + ';base64,') + base64.b64encode(logofile.read()))
 return Markup(result)

@ contextfunction def core_logo_content ( context , gif = False ) : staticpath = getattr ( settings , 'STATIC_DOC_ROOT' , './static' ) logopath = ( staticpath + '/logo' ) if gif : logopath += '.gif' mimetype = 'image/gif' else : logopath += '.png' mimetype = 'image/png' customlogo = '' try : conf = ModuleSetting . get_for_module ( 'treeio.core' , 'logopath' ) [ 0 ] customlogo = ( getattr ( settings , 'MEDIA_ROOT' , './static/media' ) + conf . value ) except : pass logofile = '' if customlogo : try : logofile = open ( customlogo , 'r' ) except : pass if ( not logofile ) : try : logofile = open ( logopath , 'r' ) except : pass result = ( ( ( 'data:' + mimetype ) + ';base64,' ) + base64 . b64encode ( logofile . read ( ) ) ) return Markup ( result )
return current logo encoded as base64 .