def check_haystack_error(func):
    from haystack.query import SearchQuerySet
    def wrapper(*args, **kwargs):
        if settings.HAYSTACK_SEARCH_ENGINE == 'solr':
            try:
                soldadmin = SolrCoreAdmin(SearchQuerySet().query.backend.conn.url)
                soldadmin.status()
                func(*args, **kwargs)
            except Exception, e:
                logger.error('Error contacting SOLR backend: %s' % 
                    getattr(e, 'reason', str(e)))
                raise HaystackError('Error contacting SOLR backend.')
    return wrapper
Decorator to check whether haystack backend is up and running or not.
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/txcommon/haystack_utils.py/check_haystack_error