openelections/core — pull request #183 by EricLagerg (2014-08-11 03:57:05+00:00)
Title: Added support for deleting directories in base/cache.py

In https://github.com/openelections/core/issues/180, `base/cache.py`is unable to remove directories from the cache, thus breaking the ability to remove any files.

I added a simple `try/except` which works with the existing API (`datefilter`) to remove both files and directories.

If `os.remove()` runs into an `OSError` while trying to remove a directory, `shutil.rmtree()` is called to remove the directory.