[snowy] Fix case when we actually want reCAPTCHA



commit 41b9935c93635bcc97f0760b47a65df434efdb51
Author: Brad Taylor <brad getcoded net>
Date:   Wed Jul 22 16:15:06 2009 -0400

    Fix case when we actually want reCAPTCHA

 users/forms.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/users/forms.py b/users/forms.py
index 7ad6254..cf0608a 100644
--- a/users/forms.py
+++ b/users/forms.py
@@ -26,18 +26,18 @@ class RegistrationFormUniqueUser(RegistrationFormUniqueEmail):
     Subclass of ``RegistrationFormUniqueEmail`` which verifies usernames
     against a blacklist.
     """
+    captcha = ReCaptchaField(label=_(u'Word Verification'))
+
     username_blacklist = ['about', 'accounts', 'admin', 'api', 'blog',
                           'contact', 'css', 'friends', 'images', 'index.html',
                           'news', 'notes', 'oauth', 'pony', 'register',
                           'registration', 'site_media', 'snowy', 'tomboy']
 
     def __init__(self, *args, **kwargs):
-        # This must be done before we init our base class so that the field can
-        # be properly initialized in the base __init__.
-        if settings.RECAPTCHA_ENABLED:
-            self.captcha = ReCaptchaField(label=_(u'Word Verification'))
-        
         super(RegistrationFormUniqueUser, self).__init__(*args, **kwargs)
+
+        if not settings.RECAPTCHA_ENABLED:
+            del self.fields['captcha']
         
         self.fields['username'].label = _(u'Username:')
         self.fields['username'].help_text = _(u'Maximum of 30 characters in length.')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]