示例#1
0
文件: files.py 项目: ntrrgc/blockwart
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
示例#2
0
文件: files.py 项目: ntrrgc/blockwart
 def content_hash(self):
     if self.attributes['content_type'] == 'binary':
         return hash_local_file(self.template)
     else:
         return sha1(self.content)