Example #1
0
 def _setup(self):
     backend = import_string(self._backend)
     if backend in self._dangerous:
         warnings.warn(
             warnings.UnsupportedBackend(
                 u'The {!r} backend for {} is not recommended '
                 'for production use.'.format(self._backend, self._base)))
     instance = backend(**self._options)
     self._wrapped = instance
Example #2
0
 def _setup(self):
     backend = import_string(self._backend)
     assert issubclass(backend, Service)
     if backend in self._dangerous:
         warnings.warn(
             warnings.UnsupportedBackend(
                 u"The {!r} backend for {} is not recommended "
                 "for production use.".format(self._backend, self._base)))
     instance = backend(**self._options)
     self._wrapped = instance
Example #3
0
def get_instance(attribute, options, dangerous=()):
    value = getattr(settings, attribute)

    cls = import_string(value)
    if cls in dangerous:
        warnings.warn(
            warnings.UnsupportedBackend(
                u'The {!r} backend for {} is not recommended '
                'for production use.'.format(value, attribute)))

    return cls(**options)