--On Mittwoch, Oktober 13, 2010 11:43:17 -0700 derek
<[email protected]> wrote:

> Bingo:
>
> zope.traversing.interfaces.TraversalError: (<MultiWidget
> 'form.widgets.speciesList'>, 'oops')
>
> using:
>
>     <z3c:widgetTemplate
>         mode="display"
>         widget="z3c.form.interfaces.IMultiWidget"
>         layer="z3c.form.interfaces.IFormLayer"
>         view=".interfaces.IDistributionView"
>         template="templates/SpeciesList.pt"
>         />
>
> which is exactly what I was looking for, thank you.

Great.

>> You can make the registration more specific with the other attributes
>> available for z3c.widgetTemplate, like "layer", "field" of "view".
>> "view=...IDistributionView" alone should work to overwrite the
>> multiwidget template for this view.
>
> How does one find the documentation for those?  The documentation on
> pypi is scanty, and in the actual module it is clear that it _has_ a
> "view" attribute, though I see no documentation, but even assuming
> that widgetTemplate's view attribute should be equivalent to other
> uses of "view" in zcml, I've never been able to locate a decent
> reference to the xmlns:browser directives, either.

Directive are usually declared in meta.zcml files. From there on you find
your way to the schema where the fields should have useful titles and
descriptions, and the implementation when necessary.

The documentation of the z3c template directives should be more complete.
Maybe you add a little information and guidelines to it.

The declaration of the directives in the browser namespace ended up (at
least for view and page) in zope.browserpage (factored out of
zope.app.publisher). I learned the basics from and still sometimes use
Phillip von Weitershausens book, even so it differs a lot from the current
zope. Martins book should also be a good reference. Some basic stuff like
views are not documented very well.

..Carsten

> On Oct 13, 2:18 pm, derek <[email protected]> wrote:
>> Thanks, that's all beginning to make more sense.
>>
>> On Oct 13, 1:32 pm, Carsten Senger <[email protected]> wrote:
>>
>> > Hi Derek,
>>
>> > --On Mittwoch, Oktober 13, 2010 06:35:47 -0700 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"
>> > >        />
>>
>> > I've not used the directive, but from the documentation "schema" is the
>> > schema provided by the object, not the interface of the field:
>>
>> > If you have:
>>
>> > class ISpeciesData(...):
>> >     speciesList = schema.List(...)
>>
>> > you give your.package.interfaces.ISpeciesData to the "schema="
>> > attribute and your template will be picked up by all MultiWidgets
>> > displayed for a field from ISpeciesData.
>>
>> > You can make the registration more specific with the other attributes
>> > available for z3c.widgetTemplate, like "layer", "field" of "view".
>> > "view=...IDistributionView" alone should work to overwrite the
>> > multiwidget template for this view.
>>
>> > ..Carsten
>> > _______________________________________________
>> > Product-Developers mailing list
>> > [email protected]http://lists.plone.org/mailman/listi
>> > nfo/product-developers
>>
>> _______________________________________________
>> Product-Developers mailing list
>> [email protected]http://lists.plone.org/mailman/listinf
>> o/product-developers
> _______________________________________________
> 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

Reply via email to