mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
acl optimize/fixes:
- optimize 'wb-manager acl match' command to not load entire file before matching - acl match <coll_or_file): if 'coll_or_file' exists as file, use it, don't check if auto-collection exist
This commit is contained in:
parent
9b2ae35b93
commit
c65f66e03a
@ -32,20 +32,24 @@ class ACLManager(CollectionsManager):
|
|||||||
|
|
||||||
super(ACLManager, self).__init__(coll_name, must_exist=False)
|
super(ACLManager, self).__init__(coll_name, must_exist=False)
|
||||||
|
|
||||||
# if auto collection, use default file in ./collections/<coll>/acl/<DEFAULT_FILE>
|
# if target exists as a file, use that
|
||||||
if os.path.isdir(self.curr_coll_dir):
|
if os.path.isfile(self.target):
|
||||||
|
self.acl_file = self.target
|
||||||
|
|
||||||
|
# otherwise, if auto collection, use default file in ./collections/<coll>/acl/<DEFAULT_FILE>
|
||||||
|
elif os.path.isdir(self.curr_coll_dir):
|
||||||
self.acl_file = os.path.join(self.acl_dir, self.DEFAULT_FILE)
|
self.acl_file = os.path.join(self.acl_dir, self.DEFAULT_FILE)
|
||||||
|
|
||||||
# else, treat the 'r.coll_name' param as the filename
|
# else, assume filename (may not exist yet)
|
||||||
else:
|
else:
|
||||||
self.acl_file = r.coll_name
|
self.acl_file = self.target
|
||||||
|
|
||||||
# for add/import, file doesn't have to exist
|
# for add/import, file doesn't have to exist
|
||||||
if r.op in ('add', 'importtxt'):
|
if r.op in ('add', 'importtxt'):
|
||||||
self.load_acl(False)
|
self.load_acl(False)
|
||||||
|
|
||||||
# otherwise, ensure file loaded successfully and log errors
|
# for other ops (except matching), ensure entire file loads successfully, log errors
|
||||||
else:
|
elif r.op not in ('match'):
|
||||||
if not self.load_acl(True):
|
if not self.load_acl(True):
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user