Hey

On Fri, Jul 13, 2007 at 11:21 AM, Stephan Richter
<[EMAIL PROTECTED]> wrote:
[snip]


>  Actually the opposite. I purposefully decided not to map the field's
>  description to anything, because I found it to be useless. If someone really
>  cares to map the field's description to something, I suggest writing a
>  traversal adapter that returns this info; something like this:
>
>  widgets/name/@@hint
>
>  <div class="hint">
>     field description
>  </div>

Mmm....How this traversal adapter would look like? I mean, to solve my
problem I wrote a view for z3c.form.interfaces.IWidget to get the
description as following:

from zope.publisher.browser import BrowserPage

class Hint(BrowserPage):
    """A view that returns the hint from the field"""

    def __init__(self, context, request):
        self.context = context
        self.request = request

    def __call__(self):
        return self.context.field.description

This way I can simply use widget/@@hint and it works.
Am I abusing here? I am interested on how it would be accomplished
with a traversal adapter.

Best Regards,
Fernando
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to