summaryrefslogtreecommitdiffstats
path: root/askbot/startup_procedures.py
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-04-21 09:37:43 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-04-21 09:37:43 -0400
commitf63064d6c419e2273e655f7387bed868f514dfdd (patch)
treedfe8bdd26125469c6c1a3b726e4fc23fd4627e6a /askbot/startup_procedures.py
parente46a41e6e4c88c0b6ca96d7a01edcb4e5ab94002 (diff)
downloadaskbot-f63064d6c419e2273e655f7387bed868f514dfdd.tar.gz
askbot-f63064d6c419e2273e655f7387bed868f514dfdd.tar.bz2
askbot-f63064d6c419e2273e655f7387bed868f514dfdd.zip
added test for django-avatar, if avatar is in the INSTALLED_APPS
Diffstat (limited to 'askbot/startup_procedures.py')
-rw-r--r--askbot/startup_procedures.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py
index e890fb89..9678fdf1 100644
--- a/askbot/startup_procedures.py
+++ b/askbot/startup_procedures.py
@@ -160,7 +160,7 @@ the list of MIDDLEWARE_CLASSES in your settings.py - these are not used any more
middleware_text = format_as_text_tuple_entries(invalid_middleware)
raise AskbotConfigError(error_message + middleware_text)
-def try_import(module_name, pypi_package_name):
+def try_import(module_name, pypi_package_name, short_message = False):
"""tries importing a module and advises to install
A corresponding Python package in the case import fails"""
try:
@@ -168,9 +168,10 @@ def try_import(module_name, pypi_package_name):
except ImportError, error:
message = 'Error: ' + unicode(error)
message += '\n\nPlease run: >pip install %s' % pypi_package_name
- message += '\n\nTo install all the dependencies at once, type:'
- message += '\npip install -r askbot_requirements.txt\n'
- message += '\nType ^C to quit.'
+ if short_message == False:
+ message += '\n\nTo install all the dependencies at once, type:'
+ message += '\npip install -r askbot_requirements.txt'
+ message += '\n\nType ^C to quit.'
raise AskbotConfigError(message)
def test_modules():
@@ -466,6 +467,19 @@ def test_settings_for_test_runner():
'from MIDDLEWARE_CLASSES'
)
print_errors(errors)
+
+
+def test_avatar():
+ """if "avatar" is in the installed apps,
+ checks that the module is actually installed"""
+ if 'avatar' in django_settings.INSTALLED_APPS:
+ try_import('Image', 'PIL', short_message = True)
+ try_import(
+ 'avatar',
+ '-e git+git://github.com/ericflo/django-avatar.git#egg=avatar',
+ short_message = True
+ )
+
def run_startup_tests():
@@ -483,6 +497,7 @@ def run_startup_tests():
test_celery()
#test_csrf_cookie_domain()
test_staticfiles()
+ test_avatar()
settings_tester = SettingsTester({
'CACHE_MIDDLEWARE_ANONYMOUS_ONLY': {
'value': True,