mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
fix(conf): don't use cache
dir as base for all data dirs
This is a bit tricky but the issue is that in a `for` loop, the loop variable(s) are shared during the whole iteration. So capturing its value in the `lambda` as `k=k` doesn't capture the value of the current iteration, but the value of the last one. In this code that happened to be `cache`, so all `data_dirs` usage was ending up with a path under `directory_cache`.
This commit is contained in:
parent
a816147e2e
commit
efd7838b02
@ -332,12 +332,14 @@ for identifier,path in data_directories.items():
|
|||||||
print("Make sure Maloja has write and execute access to this directory.")
|
print("Make sure Maloja has write and execute access to this directory.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
class DataDirs:
|
||||||
|
def __init__(self, dirs):
|
||||||
|
self.dirs = dirs
|
||||||
|
|
||||||
data_dir = {
|
def __getitem__(self, key):
|
||||||
k:lambda *x,k=k: pthj(data_directories[k],*x) for k in data_directories
|
return lambda *x, k=key: pthj(self.dirs[k], *x)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
data_dir = DataDirs(data_directories)
|
||||||
|
|
||||||
### DOREAH OBJECTS
|
### DOREAH OBJECTS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user