Ok, so, parts of this I can kind of help with. Sadly all this is is
more directions, rather than the map you're after, but perhaps it can
help.

class ReCaptcha(FormField):
    template = """
    <div xmlns:py="http://purl.org/kid/ns#";>
        <script type="text/javascript" src="${api_server}/challenge?k=$
{public_key}"></script>

        <noscript>
          <iframe src="${api_server}/noscript?k=${public_key}"
height="300" width="500" frameborder="0"></iframe><br />
          <textarea name="recaptcha_challenge_field" rows="3"
cols="40"></textarea>
          <input type='hidden' name='recaptcha_response_field'
value='manual_challenge' />
        </noscript>
    </div>
    """

    def update_params(self, d):
        super(ReCaptcha, self).update_params(d)
        d['api_server'] = config.get('recaptcha.api_server')
        d['public_key'] = config.get('recaptcha.public_key')

This is a custom formfield, you can see the use of a variety of
related bits and pieces, it works in conjunction with a custom
validator.

The main trick, from your perspective, is the template. You can see
it's a full kid template and I could have changed the formatting
depending on a custom or standard variable. You'll notice the use of
update_params to add the api_server and public_key pieces to the
parameters, but you can also access any parameters passed in at widget
creation at the same time.

I *think* this answers what you're asking about, but perhaps not.
Please feel free to ask for more details or whatever, I have a growing
pile of custom stuff like that as part of my regular base setup so I
can probably find other examples if needed.



> Is update_params only called once, then? This would allow me to modify
> my data based on the flags I passed in, which is one way of doing it.
> But is there some way I can call back out to a Widget's methods from
> the Kid template? Or is my interface with the template limited to
> whatever is in 'params'?
>
> --
> Ben Sizer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to