Ignore:
Timestamp:
Aug 18, 2011 8:34:55 AM (8 years ago)
Author:
vmaksymiv
Message:

has added CaptchaError? exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.z3cform.captcha/trunk/quintagroup/z3cform/captcha/widget.py

    r1960 r3257  
    99from z3c.form.browser.text import TextWidget 
    1010 
     11 
     12class CaptchaError(BaseException): 
     13    def __init__(self, value): 
     14        self.value = value 
     15    def __str__(self): 
     16        return repr(self.value) 
     17 
     18 
    1119class CaptchaWidget(TextWidget): 
    1220     
    1321   def getCaptcha(self): 
    14        return self.form.context.getCaptcha() 
     22       try: 
     23           return self.form.context.getCaptcha() 
     24       except AttributeError: 
     25           raise CaptchaError('quintagroup.captcha.core not installed. ' 
     26                              'Install quintagroup.captcha.core using Quickinstaller or Plone Control Panel') 
    1527 
    1628   def render(self): 
Note: See TracChangeset for help on using the changeset viewer.