def generate_static_name(name, base=None):
 if base:
  path = os.path.join(base, name)
 else:
  path = name
 sha = hashlib.sha1(open(path).read()).digest()
 shorthash = base64.urlsafe_b64encode(sha[0:8]).rstrip('=')
 (name, ext) = os.path.splitext(name)
 return (((name + '.') + shorthash) + ext)

def generate_static_name ( name , base = None ) : if base : path = os . path . join ( base , name ) else : path = name sha = hashlib . sha1 ( open ( path ) . read ( ) ) . digest ( ) shorthash = base64 . urlsafe_b64encode ( sha [ 0 : 8 ] ) . rstrip ( '=' ) ( name , ext ) = os . path . splitext ( name ) return ( ( ( name + '.' ) + shorthash ) + ext )
generate a unique filename .