From 7c0533bae490449ad9180ed00e3ceb876a2fbda9 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Wed, 9 Nov 2011 17:03:14 -0300 Subject: fixed celery startup_procedure test --- askbot/startup_procedures.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 08b91e7a..5a7b6799 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -34,7 +34,7 @@ def format_as_text_tuple_entries(items): # # *validate emails in settings.py def test_askbot_url(): - """Tests the ASKBOT_URL setting for the + """Tests the ASKBOT_URL setting for the well-formedness and raises the ImproperlyConfigured exception, if the setting is not good. """ @@ -91,8 +91,8 @@ def test_middleware(): if missing_middleware_set: error_message = """\n\nPlease add the following middleware (listed after this message) -to the MIDDLEWARE_CLASSES variable in your site settings.py file. -The order the middleware records may be important, please take a look at the example in +to the MIDDLEWARE_CLASSES variable in your site settings.py file. +The order the middleware records may be important, please take a look at the example in https://github.com/ASKBOT/askbot-devel/blob/master/askbot/setup_templates/settings.py:\n\n""" middleware_text = format_as_text_tuple_entries(missing_middleware_set) raise ImproperlyConfigured(PREAMBLE + error_message + middleware_text) @@ -112,7 +112,7 @@ the list of MIDDLEWARE_CLASSES in your settings.py - these are not used any more middleware_text = format_as_text_tuple_entries(remove_middleware_set) raise ImproperlyConfigured(PREAMBLE + error_message + middleware_text) - + def test_i18n(): """askbot requires use of USE_I18N setting""" @@ -124,7 +124,7 @@ def test_i18n(): ) def try_import(module_name, pypi_package_name): - """tries importing a module and advises to install + """tries importing a module and advises to install A corresponding Python package in the case import fails""" try: load_module(module_name) @@ -173,25 +173,35 @@ def test_encoding(): ) def test_template_loader(): - """Sends a warning if you have an old style template + """Sends a warning if you have an old style template loader that used to send a warning""" old_template_loader = 'askbot.skins.loaders.load_template_source' if old_template_loader in django_settings.TEMPLATE_LOADERS: raise ImproperlyConfigured(PREAMBLE + \ "\nPlease change: \n" - "'askbot.skins.loaders.load_template_source', to\n" + "'askbot.skins.loaders.load_template_source', to\n" "'askbot.skins.loaders.filesystem_load_template_source',\n" "in the TEMPLATE_LOADERS of your settings.py file" ) def test_celery(): """Tests celery settings""" - if hasattr(django_settings, 'BROKER_BACKEND'): + broker_backend = getattr(django_settings, 'BROKER_BACKEND', None) + broker_transport = getattr(django_settings, 'BROKER_TRANSPORT', None) + + if broker_backend != broker_transport: + raise ImproperlyConfigured(PREAMBLE + \ + "\nPlese check that BROKER_BACKEND and BROKER_TRANSPORT have \n" + "then same value in your settings.py file" + ) + + if hasattr(django_settings, 'BROKER_BACKEND') and not hasattr(django_settings, 'BROKER_TRANSPORT'): raise ImproperlyConfigured(PREAMBLE + \ "\nPlease rename setting BROKER_BACKEND to BROKER_TRANSPORT\n" "in your settings.py file" ) + def run_startup_tests(): """function that runs all startup tests, mainly checking settings config so far -- cgit v1.2.3-1-g7c22