diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-07-31 17:02:45 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-07-31 17:02:45 -0400 |
commit | add74664b45a6ae3a87d7ed5722b99768fbeae1f (patch) | |
tree | 6edac1100639815cada933115e1003fb9f61ef6d | |
parent | fc395fde06dad5d9010dd9a985df4b2246ca72b1 (diff) | |
download | askbot-add74664b45a6ae3a87d7ed5722b99768fbeae1f.tar.gz askbot-add74664b45a6ae3a87d7ed5722b99768fbeae1f.tar.bz2 askbot-add74664b45a6ae3a87d7ed5722b99768fbeae1f.zip |
django-recaptcha-works module works indeed, also added a simple framework to auto-test dependencies
-rw-r--r-- | askbot/deps/django_authopenid/views.py | 2 | ||||
-rw-r--r-- | askbot/startup_procedures.py | 15 | ||||
-rw-r--r-- | askbot_requirements.txt (renamed from requirements.txt) | 0 |
3 files changed, 17 insertions, 0 deletions
diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py index 212e94ff..5610a7fb 100644 --- a/askbot/deps/django_authopenid/views.py +++ b/askbot/deps/django_authopenid/views.py @@ -46,6 +46,7 @@ from django.utils.html import escape from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe from django.core.mail import send_mail +from recaptcha_works.decorators import fix_recaptcha_remote_ip from askbot.skins.loaders import render_into_skin, get_template from openid.consumer.consumer import Consumer, \ @@ -877,6 +878,7 @@ def signin_failure(request, message): @not_authenticated @decorators.valid_password_login_provider_required @csrf.csrf_protect +@fix_recaptcha_remote_ip def signup_with_password(request): """Create a password-protected account template: authopenid/signup_with_password.html diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 106a6d4f..23146c95 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -7,10 +7,12 @@ question: why not run these from askbot/__init__.py? the main function is run_startup_tests """ +import sys from django.db import transaction from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured from askbot.models import badges +from askbot.utils.loading import load_module #todo: # @@ -87,12 +89,25 @@ def test_i18n(): 'it is very important for askbot.' ) +def try_import(module_name, pypi_package_name): + try: + load_module(module_name) + except ImportError, e: + message = unicode(e) + 'run "pip install %s"' % pypi_package_name + message += '\nalternatively, type "pip install -r askbot_requirements.txt"\n' + message += 'to satisfy all requirements for askbot' + raise ImproperlyConfigured(message) + +def test_modules(): + try_import('recaptcha_works', 'django-recaptcha-works') + def run_startup_tests(): """function that runs all startup tests, mainly checking settings config so far """ #todo: refactor this when another test arrives + test_modules() test_askbot_url() test_i18n() test_middleware() diff --git a/requirements.txt b/askbot_requirements.txt index ba72edb8..ba72edb8 100644 --- a/requirements.txt +++ b/askbot_requirements.txt |