[Zope3-Users] custom widgets (IDisplayWidget)
FB
fbo2 at gmx.net
Sat Nov 25 13:07:56 EST 2006
Hi,
On Sun, Nov 26, 2006 at 01:13:43AM +0900, Hassan Alirezaei wrote:
> Sascha Ottolski wrote:
> >the above seems to build upon an interesting looking package z3c.language:
> >
> >http://svn.zope.org/z3c.language/trunk/src/z3c/language/
> Thanks for mentioning.
> Back to the source of the problem. Maybe I am getting all this wrong. Alright, one simple question:
> --------------------------------------------------
> what happens when you add an object which uses a widget:
>
> homepage = URI(title=_("HomePage"),required=False)
>
> and then call that widget by the following line of zpt :
>
> <span tal:content="context/homepage">some</span>
>
> Isn't it that a view that is registered for the zope.schema.URI like the following should be called????
No widget is called. Problem is, there's no schema information contained in
"context/homepage". What the template engine does is basically
str(context.homepage)
and context.homepage is most likely just a plain string (like BytesLine,
DottedName, ...) without any interfaces, zope could adapt. This is why i
"invented" a tales namespace. Using the fb-package this example would do
something useful:
<span tal:content="context/something_multilingual/fbi18n:text" />
'fbi18n:text' might be doing more than you want. If it detects a search
engine spider, it presents all language version in separate span-tags (incl.
lang-attributes). 'fbi18n:simpletext' just includes the best matching
language version.
Regards,
Frank
More information about the Zope3-users
mailing list