Changeset 7300 for main/waeup.sirp/trunk


Ignore:
Timestamp:
7 Dec 2011, 06:10:38 (13 years ago)
Author:
uli
Message:

Rename IdCaptcha? to StaticCaptcha? and make it even more plain.

File:
1 edited

Legend:

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

    r7299 r7300  
    188188## TestCaptcha
    189189##
    190 class IdCaptcha(object):
    191     """The IdCaptcha allows all solutions that equal a challenge.
    192 
    193     The challenge is a permutation of 'abcdefg'.
     190class StaticCaptcha(object):
     191    """The StaticCaptcha always has the same solution: 'the-solution'.
    194192
    195193    It is of no use for real world but for tests. In tests we cannot
     
    197195    works like a real one but is easy to solve even for machines.
    198196
    199     It is called IdCaptcha because solutions and challenges for this
    200     captcha type are mapped by identitiy function.
     197    The HTML form piece generated is even prefilled with the correct
     198    solution. So in tests it is not necessary to always 'type' the
     199    solution string in the correct field.
     200
     201    You can, however, fill in a wrong solution and it will be detected
     202    as such.
    201203    """
    202204    grok.implements(ICaptcha)
     
    220222        """Display challenge and input field for solution as HTML.
    221223        """
    222         challenge = list('abcdef')
    223         random().shuffle(challenge)
    224         challenge = ''.join(challenge)
    225224        html = (
    226225            u'<input type="hidden" name="challenge"'
    227             u'       value="%s" /><br />'
     226            u'       value="the-solution" /><br />'
    228227            u'Type: %s<br />'
    229             u'<input type="text" name="solution" /><br />' % (
    230                 challenge, challenge))
     228            u'<input type="text" name="solution" value="the-solution"'
     229            u' /><br />')
    231230        return html
    232231
    233 grok.global_utility(IdCaptcha, name=u'Testing captcha')
     232grok.global_utility(StaticCaptcha, name=u'Testing captcha')
    234233
    235234
Note: See TracChangeset for help on using the changeset viewer.