Răsfoiți Sursa

inline archive_size and archive_path snapshot methods

Nick Sweeting 4 ani în urmă
părinte
comite
48eddadc9b
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      archivebox/core/models.py

+ 5 - 2
archivebox/core/models.py

@@ -144,11 +144,14 @@ class Snapshot(models.Model):
 
 
     @cached_property
     @cached_property
     def archive_path(self):
     def archive_path(self):
-        return self.as_link().archive_path
+        return '{}/{}'.format(ARCHIVE_DIR_NAME, self.timestamp)
 
 
     @cached_property
     @cached_property
     def archive_size(self):
     def archive_size(self):
-        return self.as_link().archive_size
+        try:
+            return get_dir_size(self.link_dir)[0]
+        except Exception:
+            return 0
 
 
     @cached_property
     @cached_property
     def history(self):
     def history(self):