def get_captcha_field(): """return the captcha field to use""" default_field = 'snowpenguin.django.recaptcha2.fields.ReCaptchaField' default_widget = 'snowpenguin.django.recaptcha2.widgets.ReCaptchaWidget' captcha_field = load_class('BALAFON_CAPTCHA_FIELD', default_field) captcha_widget = load_class('BALAFON_CAPTCHA_WIDGET', default_widget) captcha_help_text = getattr(settings, 'BALAFON_CAPTCHA_HELP_TEXT', _(u"Make sure you are a human")) if captcha_widget: return captcha_field(widget=captcha_widget, help_text=captcha_help_text) else: return captcha_field(help_text=captcha_help_text)
def get_registration_form(): """returns a form to be used for editing a user profile""" return load_class('BALAFON_REGISTRATION_FORM', 'balafon.Profile.forms.UserRegistrationForm')
def test_load_no_default(self): form_class = load_class('COOP_CMS_ARTICLE_SETTINGS_FORM', '') self.assertEqual(form_class, None)
def get_profile_form(): """returns a form to be used for editing a user profile""" return load_class('BALAFON_PROFILE_FORM', 'balafon.Profile.forms.ProfileForm')
def test_load_value(self): form_class = load_class('COOP_CMS_ARTICLE_SETTINGS_FORM', 'coop_cms.forms.NewArticleForm') self.assertEqual(form_class, ArticleSettingsForm)
def test_load_default(self): form_class = load_class('COOP_CMS_ARTICLE_SETTINGS_FORM', 'coop_cms.forms.NewArticleForm') self.assertEqual(form_class, NewArticleForm)