parameters: (filename)
return_statement: return ",".join((filename, filemd5))
docstring: Return a filename suitable for the cache.
  
      Strips dangerous and common characters to create a filename we
      can use to store the cache in.
docstring_summary: Return a filename suitable for the cache.
docstring_tokens: Return a filename suitable for the cache .
function: def safename(filename):
      """Return a filename suitable for the cache.
  
      Strips dangerous and common characters to create a filename we
      can use to store the cache in.
      """
  
      try:
          if re_url_scheme.match(filename):
              if isinstance(filename,str):
                  filename = filename.decode('utf-8')
                  filename = filename.encode('idna')
              else:
                  filename = filename.encode('idna')
      except UnicodeError:
          pass
      if isinstance(filename,unicode):
          filename=filename.encode('utf-8')
      filemd5 = _md5(filename).hexdigest()
      filename = re_url_scheme.sub("", filename)
      filename = re_slash.sub(",", filename)
  
      # limit length of filename
      if len(filename)>200:
          filename=filename[:200]
      return ",".join((filename, filemd5))
function_tokens: def safename ( filename ) : try : if re_url_scheme . match ( filename ) : if isinstance ( filename , str ) : filename = filename . decode ( 'utf-8' ) filename = filename . encode ( 'idna' ) else : filename = filename . encode ( 'idna' ) except UnicodeError : pass if isinstance ( filename , unicode ) : filename = filename . encode ( 'utf-8' ) filemd5 = _md5 ( filename ) . hexdigest ( ) filename = re_url_scheme . sub ( "" , filename ) filename = re_slash . sub ( "," , filename ) # limit length of filename if len ( filename ) > 200 : filename = filename [ : 200 ] return "," . join ( ( filename , filemd5 ) )