Example #1
0
def hash_local_file(path):
    """
    Retuns the sha1 hash of a file on the local machine.
    """
    with open(path, 'rb') as f:
        sha1_hash = sha1(f.read())
    return sha1_hash
Example #2
0
 def content_hash(self):
     if self.attributes['content_type'] == 'binary':
         return hash_local_file(self.template)
     else:
         return sha1(self.content)