Fixing error on committing to cache for rate limits when the dummy cache backend is used.

This commit is contained in:
Samuel Clay 2011-11-23 16:34:36 -05:00
parent 8865f6fbfd
commit a7b8233727

View file

@ -46,7 +46,7 @@ class ratelimit(object):
# add first, to ensure the key exists
cache.add(key, 0, self.expire_after())
cache.incr(key)
except AttributeError:
except (AttributeError, ValueError):
cache.set(key, cache.get(key, 0) + 1, self.expire_after())
def should_ratelimit(self, request):