Hi,

On 2 October 2010 16:53, Michael Smith <[email protected]> wrote:

> I'm trying to learn how to create custom widgets for dexterity fields.


Correction: You want to learn how to make custom z3c.form widgets; There's
nothing Dexterity-specific about widgets.


> I started by reading this: http://wiki.zope.org/zope3/Z3cZcml
>
> I haven't gotten all the way through it because it tries to import some
> modules that don't exist in my vanilla Plone 4 +
> http://good-py.appspot.com/release/dexterity/1.0b2?plone=4.0 Dexterity
> install, but before I continue, am I on the right track?
>

I suspect so. I did start writing some more in depth documentation on this,
but I never got to the "custom widgets" part. I do want to pick it up again,
I just need to get other projects out of the way again.


> Is there a better set of instructions/demonstration I should use for
> developing a custom widget, and if not, are these modules missing because I
> need to install them, or because the instructions are out of date?
>

I suspect because the instructions are out of date.

You may want to look at something like plone.formwidget.namedfile, which is
a pretty simple widget. The z3c.form docs on
http://pypi.python.org/pypi/z3c.form are good for reference information as
well.


> >>> from z3c.form.testing import TestRequestTraceback (most recent call
> last):
>  File "<stdin>", line 1, in <module>
>  File
> "/Users/michael/Plone/buildout-cache/eggs/z3c.form-2.3.3-py2.6.egg/z3c/form/testing.py",
> line 42, in <module>
>    import lxml.html
> ImportError: No module named lxml.html
>

Ah, OK. This is because lxml is a test-time (only) dependency of z3c.form
testing stuff. You can add it to your buildout manually or depend on
z3c.form [test], I believe.


> >>> from z3c.template.interfaces import IPageTemplate
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named template.interfaces
>

That looks like z3c.template is an optional dependency in this example;
you'd need to add it as a dependency of your package, although I'm not aware
that it's used in current widgets.

Martin
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to