Mercurial > public > queues
changeset 31:06f1c0a8557d
Loosen restriction for what is considered a "valid" queue backend.
author | btimby |
---|---|
date | Sun, 05 Feb 2012 03:30:23 +0000 |
parents | d4563cb0376c |
children | c70414fbc552 |
files | queues/__init__.py queues/backends/__init__.py |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/queues/__init__.py Sun Feb 05 03:28:19 2012 +0000 +++ b/queues/__init__.py Sun Feb 05 03:30:23 2012 +0000 @@ -20,7 +20,7 @@ * http://code.google.com/p/stomperl/ * RabbitMQ """ -import os +import os, inspect __version__ = "0.6.2" @@ -58,6 +58,5 @@ raise InvalidBackend("Unable to import QUEUE BACKEND '%s'" % BACKEND) # Check that this is really a queues backend, not just some other random # module. - from .backends.base import BaseQueue - if not getattr(queues, 'Queue', None) in BaseQueue.__subclasses__(): - raise InvalidBackend("Unable to import QUEUE_BACKEND '%s' does not appear to be valid." % BACKEND) + if not inspect.isclass(getattr(queues, 'Queue', None)): + raise InvalidBackend("Unable to import QUEUE BACKEND '%s' does not appear to be valid." % BACKEND)
--- a/queues/backends/__init__.py Sun Feb 05 03:28:19 2012 +0000 +++ b/queues/backends/__init__.py Sun Feb 05 03:30:23 2012 +0000 @@ -1,4 +1,4 @@ -import os +import os, inspect from queues import InvalidBackend __all__ = ['backend'] @@ -25,6 +25,5 @@ backend = __import__(BACKEND, {}, {}, ['']) except ImportError: raise InvalidBackend("Unable to import QUEUE BACKEND '%s'" % BACKEND) - from .base import BaseQueue - if not getattr(backend, 'Queue', None) in BaseQueue.__subclasses__(): + if not inspect.isclass(getattr(backend, 'Queue', None)): raise InvalidBackend("Unable to import QUEUE BACKEND '%s' does not appear to be valid." % BACKEND)