diff piecrust/cache.py @ 105:7d2fdf43d7ca

Property clean all caches when force baking, except the `app` cache.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 17 Sep 2014 21:49:25 -0700
parents efd0d3bacc9e
children c2ca72fb7f0b
line wrap: on
line diff
--- a/piecrust/cache.py	Mon Sep 15 08:12:55 2014 -0700
+++ b/piecrust/cache.py	Wed Sep 17 21:49:25 2014 -0700
@@ -35,6 +35,12 @@
     def getCacheDir(self, name):
         return os.path.join(self.base_dir, name)
 
+    def getCacheNames(self, except_names=None):
+        _, dirnames, __ = next(os.walk(self.base_dir))
+        if except_names is None:
+            return dirnames
+        return [dn for dn in dirnames if dn not in except_names]
+
 
 class SimpleCache(object):
     def __init__(self, base_dir):