From 40ef3f5e05f5db071566a5caf55a7b1264ae083d Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sun, 24 Feb 2013 00:23:05 +0100 Subject: [PATCH] plugin/raven: Fix paster's celery config issue Check for CELERY_CONFIG_MODULE before we import raven.contrib.celery. It seems that the import otherwise sets up the celery client before we get to pass it our mediagoblin-specific settings. --- mediagoblin/plugins/raven/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mediagoblin/plugins/raven/__init__.py b/mediagoblin/plugins/raven/__init__.py index a0e83c0a..16b3b94b 100644 --- a/mediagoblin/plugins/raven/__init__.py +++ b/mediagoblin/plugins/raven/__init__.py @@ -18,13 +18,17 @@ import os import logging from mediagoblin.tools import pluginapi -from raven import Client -from raven.contrib.celery import register_signal _log = logging.getLogger(__name__) def setup_plugin(): + if not os.environ.get('CELERY_CONFIG_MODULE'): + # Exit early if we're (seemingly) not called from the celery process + return + + from raven import Client + from raven.contrib.celery import register_signal config = pluginapi.get_config('mediagoblin.plugins.raven') _log.info('Setting up raven for celery...') -- 2.25.1