Ignore:
Timestamp:
9 Dec 2011, 10:47:04 (13 years ago)
Author:
uli
Message:

Add captcha field in configuration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py

    r7250 r7313  
    124124        return title
    125125
     126class CaptchaSource(BasicSourceFactory):
     127    """A source for captchas.
     128    """
     129    def getValues(self):
     130        captchas = ['No captcha', 'ReCaptcha']
     131        try:
     132            # we have to 'try' because IConfiguration can only handle
     133            # interfaces from w.s.interface.
     134            from waeup.sirp.browser.interfaces import ICaptchaManager
     135        except:
     136            return captchas
     137        return sorted(getUtility(ICaptchaManager).getAvailCaptchas().keys())
     138
     139    def getTitle(self, value):
     140        return value
     141
    126142class IWAeUPObject(Interface):
    127143    """A WAeUP object.
     
    415431        )
    416432
     433    captcha = schema.Choice(
     434        title = u'Captcha used for applicant registration pages',
     435        source = CaptchaSource(),
     436        default = u'No captcha',
     437        required = True,
     438        )
    417439
    418440class ISessionConfiguration(IWAeUPObject):
Note: See TracChangeset for help on using the changeset viewer.