OK, it was an interesting suggestion, but even if it works (it _should_ but no mention is made specifically of templates for widgets), it is an override of every instance of a specific template (at least in a given layer). I know - that's what my example showed, but in fact I want to be able to extend the schema for a field, and override the template for the widget displaying that field. Since I can't even get it to work for the default widget/schema combinations, I can't see how I can do it for a custom combo.
On Oct 13, 11:41 am, Roel Bruggink <[email protected]> wrote: > I think z3c.jbot is what you need. > > > > On Wed, Oct 13, 2010 at 3:35 PM, derek <[email protected]> wrote: > > Is it possible to override just a template for a widget, without > > creating a whole new Widget, WidgetFactory, Field and associated > > interfaces? I have whole modules full of empty classes just to get to > > a special template, which it seems I ought to be able to do with a > > <z3c:objectWidgetTemplate> directive , but no matter how I try I can't > > get no satisfaction. > > > In my zcml, I have: > > > <z3c:objectWidgetTemplate > > mode="display" > > template="templates/SpeciesList.pt" > > widget="z3c.form.interfaces.IMultiWidget" > > schema="zope.schema.interfaces.IList" > > /> > > > and the template is: > > <div tal:content="view/oops"> > > Body > > </div> > > (and "oops" is not a valid attribute, so I fully expect an error here) > > > When I test my view: > > >>> f=DistributionView(None,request) > > >>> f.update() > > >>> f.widgets.keys() > > ['rowCount', 'map', 'speciesCount', 'speciesList', 'dateRange', > > 'dataSources'] > > >>> w=f.widgets['speciesList'] > > >>> w.__class__ > > <class 'z3c.form.browser.multi.MultiWidget'> > > >>> w.field.__class__ > > <class 'zope.schema._field.List'> > > >>> print w.render() > > > <div id="form-widgets-speciesList" > > class="multi-widget required"> > > </div> > > > _______________________________________________ > > Product-Developers mailing list > > [email protected] > >http://lists.plone.org/mailman/listinfo/product-developers > > -- > Roel Brugginkhttp://www.fourdigits.nl/mensen/roel-bruggink > > Four Digits BVhttp://www.fourdigits.nl > Willemsplein 44, 6811 KD, Arnhem > tel: +31(0)26 4422700 fax: +31(0)26 7600012 > KVK 091621370000 BTW 8161.22.234.B01 > > _______________________________________________ > Product-Developers mailing list > [email protected]http://lists.plone.org/mailman/listinfo/product-developers _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
