Merge branch '8784-dir-listings'
[arvados.git] / services / arv-web / arv-web.py
index e7315585a02d407e33ee25b2317a7206c1aeb51d..55b710a754dbc745b185327b9009bab4688087f8 100755 (executable)
@@ -1,12 +1,16 @@
 #!/usr/bin/env python
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
 # arv-web enables you to run a custom web service from the contents of an Arvados collection.
 #
 # See http://doc.arvados.org/user/topics/arv-web.html
 
 import arvados
+from arvados.safeapi import ThreadSafeApiCache
 import subprocess
-from arvados_fuse import Operations, SafeApi, CollectionDirectory
+from arvados_fuse import Operations, CollectionDirectory
 import tempfile
 import os
 import llfuse
@@ -32,7 +36,7 @@ class ArvWeb(object):
         self.override_docker_image = docker_image
         self.port = port
         self.evqueue = Queue.Queue()
-        self.api = SafeApi(arvados.config)
+        self.api = ThreadSafeApiCache(arvados.config.settings())
 
         if arvados.util.group_uuid_pattern.match(project) is None:
             raise arvados.errors.ArgumentError("Project uuid is not valid")
@@ -71,7 +75,7 @@ class ArvWeb(object):
                         et = 'add'
                     else:
                         et = 'remove'
-                if ev['properties']['new_attributes']['expires_at'] is not None:
+                if ev['properties']['new_attributes']['trash_at'] is not None:
                     et = 'remove'
 
             self.evqueue.put((self.project, et, ev['object_uuid']))
@@ -82,7 +86,7 @@ class ArvWeb(object):
     def run_fuse_mount(self):
         self.mountdir = tempfile.mkdtemp()
 
-        self.operations = Operations(os.getuid(), os.getgid(), "utf-8")
+        self.operations = Operations(os.getuid(), os.getgid(), self.api, "utf-8")
         self.cdir = CollectionDirectory(llfuse.ROOT_INODE, self.operations.inodes, self.api, 2, self.collection)
         self.operations.inodes.add_entry(self.cdir)