Add Migration class to hold the path, app name and migration name in one object + adapt existing logic

This commit is contained in:
David-Wobrock committed 2019-01-05 16:59:36 +01:00
1 parent f0021dc139
commit c6df7e53a0
3 files changed
+17 -11

No files matched your search

+2 -3
View File
@@ -16,7 +16,7 @@ import hashlib
import os
import pickle
from django_migration_linter.utils import split_path, compose_migration_path
from django_migration_linter.utils import split_path
class Cache(dict):
@@ -42,8 +42,7 @@ class Cache(dict):
with open(self.filename, "wb") as f:
pickle.dump(self, f, protocol=2)
def md5(self, app_name, migration):
path = compose_migration_path(self.django_folder, app_name, migration)
def md5(self, path):
hash_md5 = hashlib.md5()
with open(path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):