def render(self, name, value, attrs=None):
     try:
         pubkey = settings.RECAPTCHA[Site.objects.get_current().domain]['public']
     except IndexError:
         return mark_safe(u'<p>Recaptcha is not configured properly.</p>')
     html = librecaptcha.displayhtml(pubkey,
                                     theme=RECAPTCHA_THEME,
                                     lang=RECAPTCHA_LANG)
     return mark_safe(html)
Example #2
0
 def render(self, name, value, attrs=None):
     try:
         pubkey = SettingsCached.param.RECAPTCHA_PUBLIC_KEY
     #FIXED 23.13.2009
     #except IndexError:
     except (IndexError, KeyError):
         return mark_safe(u'<p>Recaptcha is not configured properly.</p>')
     html = librecaptcha.displayhtml(pubkey,
                                     theme=SettingsCached.param.RECAPTCHA_THEME,
                                     lang=SettingsCached.param.LANGUAGE_CODE[:2])
     return mark_safe(html)
Example #3
0
 def render(self, name, value, attrs=None):
     if isinstance(settings.RECAPTCHA_PUBLIC_KEY, dict):
         request = obtain_request()
         public_key = settings.RECAPTCHA_PUBLIC_KEY[request.get_host().lower()]
     else:
         public_key = settings.RECAPTCHA_PUBLIC_KEY
     
     html = displayhtml(public_key,
                        theme=RECAPTCHA_THEME,
                        lang=RECAPTCHA_LANG)
     return mark_safe(html)
Example #4
0
 def render(self, name, value, attrs=None):
     html = librecaptcha.displayhtml(settings.RECAPTCHA_PUB_KEY,
                                     theme=RECAPTCHA_THEME,
                                     lang=RECAPTCHA_LANG)
     return mark_safe(html)
Example #5
0
 def render(self, name, value, attrs=None):
     html = librecaptcha.displayhtml(settings.RECAPTCHA_PUBLIC_KEY,
                                     theme=RECAPTCHA_THEME,
                                     lang=RECAPTCHA_LANG)
     return mark_safe(html)
Example #6
0
 def render(self, name, value, attrs=None):
     final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
     html = u"<script>var RecaptchaOptions = {theme : '%s'};</script>" % (
         final_attrs.get('theme', 'white'))
     html += librecaptcha.displayhtml(public_key=settings.RECAPTCHA_PUBLIC,ajax_js='%sjs/recaptcha_ajax.js' % settings.MEDIA_URL)
     return mark_safe(html)