From b886ba76dec436a5d2d888032338baaa1fbb07db Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Mon, 2 Apr 2012 00:32:59 +0200 Subject: [PATCH] Fix AttributeError. --- rq/local.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rq/local.py b/rq/local.py index a461a9f..e789c81 100644 --- a/rq/local.py +++ b/rq/local.py @@ -161,7 +161,10 @@ class LocalStack(object): return None def __len__(self): - return len(self._local.stack) + stack = getattr(self._local, 'stack', None) + if stack is None: + return 0 + return len(stack) class LocalManager(object):