Show More
@@ -370,16 +370,21 class fncachestore(basicstore): | |||||
370 | self.encode = encode |
|
370 | self.encode = encode | |
371 | self.path = path + '/store' |
|
371 | self.path = path + '/store' | |
372 | self.createmode = _calcmode(self.path) |
|
372 | self.createmode = _calcmode(self.path) | |
373 | op = openertype(self.path) |
|
373 | ||
|
374 | storeself = self | |||
|
375 | ||||
|
376 | class fncacheopener(openertype): | |||
|
377 | def __call__(self, path, mode='r', *args, **kw): | |||
|
378 | if mode not in ('r', 'rb') and path.startswith('data/'): | |||
|
379 | fnc.add(path) | |||
|
380 | return openertype.__call__(self, storeself.encode(path), mode, | |||
|
381 | *args, **kw) | |||
|
382 | ||||
|
383 | op = fncacheopener(self.path) | |||
374 | op.createmode = self.createmode |
|
384 | op.createmode = self.createmode | |
375 | fnc = fncache(op) |
|
385 | fnc = fncache(op) | |
376 | self.fncache = fnc |
|
386 | self.fncache = fnc | |
377 |
|
387 | self.opener = op | ||
378 | def fncacheopener(path, mode='r', *args, **kw): |
|
|||
379 | if mode not in ('r', 'rb') and path.startswith('data/'): |
|
|||
380 | fnc.add(path) |
|
|||
381 | return op(self.encode(path), mode, *args, **kw) |
|
|||
382 | self.opener = fncacheopener |
|
|||
383 |
|
388 | |||
384 | def join(self, f): |
|
389 | def join(self, f): | |
385 | return self.path + '/' + self.encode(f) |
|
390 | return self.path + '/' + self.encode(f) |
General Comments 0
You need to be logged in to leave comments.
Login now