diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-11-18 04:27:59 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-11-18 04:27:59 -0300 |
commit | 93019fdd50974f3034b944e74953c4380319f65c (patch) | |
tree | 7f3f30043512c385eaa0acbd1a968950bb913446 /askbot/startup_procedures.py | |
parent | cfc7add4e295ab6efefe048ea0b09676cfb314be (diff) | |
parent | 2214ac955d9c7e38e8078a35998fa33b82d89df3 (diff) | |
download | askbot-93019fdd50974f3034b944e74953c4380319f65c.tar.gz askbot-93019fdd50974f3034b944e74953c4380319f65c.tar.bz2 askbot-93019fdd50974f3034b944e74953c4380319f65c.zip |
merged with the group-messaging branch
Diffstat (limited to 'askbot/startup_procedures.py')
-rw-r--r-- | askbot/startup_procedures.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index acb99b50..1fa1b3e7 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -767,6 +767,38 @@ see outdated content on your site. askbot_warning(message) +def test_group_messaging(): + """tests correctness of the "group_messaging" app configuration""" + errors = list() + if 'group_messaging' not in django_settings.INSTALLED_APPS: + errors.append("add to the INSTALLED_APPS:\n'group_messaging'") + + settings_sample = ("GROUP_MESSAGING = {\n" + " 'base_url_getter_function': 'askbot.models.user_get_profile_url',\n" + " 'base_url_params': {'section': 'messages', 'sort': 'inbox'}\n" + "}") + + settings = getattr(django_settings, 'GROUP_MESSAGING', {}) + if settings: + url_params = settings.get('base_url_params', {}) + have_wrong_params = not ( + url_params.get('section', None) == 'messages' and \ + url_params.get('sort', None) == 'inbox' + ) + url_getter = settings.get('base_url_getter_function', None) + if url_getter != 'askbot.models.user_get_profile_url' or have_wrong_params: + errors.append( + "make setting 'GROUP_MESSAGING to be exactly:\n" + settings_sample + ) + + url_params = settings.get('base_url_params', None) + else: + errors.append('add this to your settings.py:\n' + settings_sample) + + if errors: + print_errors(errors) + + def run_startup_tests(): """function that runs all startup tests, mainly checking settings config so far @@ -787,6 +819,7 @@ def run_startup_tests(): test_new_skins() test_longerusername() test_avatar() + test_group_messaging() test_haystack() test_cache_backend() settings_tester = SettingsTester({ |