[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[snapshot/master] Actually, there is no reason why we should even get a db handle just to return a file whose hash we already know



---
 web/app/snapshot/controllers/archive.py |    2 +-
 web/app/snapshot/model/snapshotmodel.py |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/web/app/snapshot/controllers/archive.py b/web/app/snapshot/controllers/archive.py
index 859eeaf..89f4728 100644
--- a/web/app/snapshot/controllers/archive.py
+++ b/web/app/snapshot/controllers/archive.py
@@ -111,7 +111,7 @@ class ArchiveController(BaseController):
 
     def _regular_file(self, digest, visiblepath=None):
         try:
-            realpath = g.shm.get_filepath(self._db(), digest)
+            realpath = g.shm.get_filepath(digest)
             fa = SnapshotFileApp(realpath, digest, visiblepath)
             return fa(request.environ, self.start_response)
         except OSError, error:
diff --git a/web/app/snapshot/model/snapshotmodel.py b/web/app/snapshot/model/snapshotmodel.py
index 718fa80..a5cb7e1 100644
--- a/web/app/snapshot/model/snapshotmodel.py
+++ b/web/app/snapshot/model/snapshotmodel.py
@@ -242,7 +242,7 @@ class SnapshotModel:
 
         return readdir
 
-    def get_filepath(self, db, digest):
+    def get_filepath(self, digest):
         prefix1 = digest[0:2]
         prefix2 = digest[2:4]
         return os.path.join(self.farmpath, prefix1, prefix2, digest)
-- 
1.5.6.5


Reply to: