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
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
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)