fix insert hash for force not to do a commit
This commit is contained in:
parent
2a92b1f747
commit
2542719378
|
@ -26,12 +26,15 @@ class ReportHash(db.Model):
|
||||||
hash3.comment = """The normalized name of the hash."""
|
hash3.comment = """The normalized name of the hash."""
|
||||||
|
|
||||||
|
|
||||||
def insert_hash(bfile):
|
def insert_hash(bfile, commit=True):
|
||||||
hash3 = hashlib.sha3_256(bfile).hexdigest()
|
hash3 = hashlib.sha3_256(bfile).hexdigest()
|
||||||
db_hash = ReportHash(hash3=hash3)
|
db_hash = ReportHash(hash3=hash3)
|
||||||
db.session.add(db_hash)
|
db.session.add(db_hash)
|
||||||
db.session.commit()
|
if commit:
|
||||||
db.session.flush()
|
db.session.commit()
|
||||||
|
db.session.flush()
|
||||||
|
|
||||||
|
return hash3
|
||||||
|
|
||||||
|
|
||||||
def verify_hash(bfile):
|
def verify_hash(bfile):
|
||||||
|
|
Reference in New Issue