Permalink
Browse files

Adding a dummy mongodb mode

  • Loading branch information...
1 parent bc553b1 commit be6a8e14e196f7c2ccc9edb6e3365614c1a22956 Jason Baker committed Aug 12, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 shrapnel/config.py
View
@@ -144,10 +144,19 @@ def __defaults__(self):
class MongoProvider(Provider):
__abstract__ = True
+ class DummyDB(object):
+ def __getattr__(self, name):
+ raise NotImplementedError
+
def __provide__(self, method_name):
from . import mongodb
config_method = getattr(self, method_name)
config = dict(self.__defaults__().items() + config_method().items())
+ if config.get('dummy', False):
+ from warnings import warn
+ warn("Using Dummy Mongodb. If you don't know what this means, disable the dummy option in your mongo settings.")
+ return self.DummyDB()
+
return mongodb.MongoHelper(method_name, config)
def __defaults__(self):

0 comments on commit be6a8e1

Please sign in to comment.