On 2 February 2011 16:37, Kevin Gill <ke...@movieextras.ie> wrote:
> Hi,
>
> I have posted a widget on pypi. It is a z3c.form version of
> Products.DataGridField.

Found it ;-)

http://pypi.python.org/pypi/collective.z3cform.datagridfield/0.1a

Some thoughts from reading the PyPI page.

* A list of dicts is great, actually. A list of objects is OK as an
option, but I'd prefer list-of-dicts as a default.

However, list of dicts isn't compatible with
schema.List(value_type=schema.Object()), so you probably need to make
it work with schema.List(value_type=schema.Dict()).

It's a bit hard in this case to indicate the columns, though. One
solution here is to create a derivative of schema.Dict that you can
use as the value type, letting this take the columns, e.g.

class Row(schema.Dict):

    def __init__(self, schema, **kw):
        self.schema = schema
        super(Row, self).__init__(**kw)

You'd then do:

table = schema.List(title=u"Table"
        value_type=Row(title=u"tablerow", schema=ITableRowSchema))

* You'd probably also want to implement validation on the field.

* You should make the docs valid reStructuredText ;-)

* Your example uses plone.directives.form and five.grok. Hopefully,
your package doesn't depend on these (no need for it to), so it'd be
nice if the examples included a standard z3c.form form.

* If they don't already, allow_insert/delete/append should all be on
if the field is writable and all off if it isn't.

Martin
_______________________________________________
Product-Developers mailing list
Product-Developers@lists.plone.org
https://lists.plone.org/mailman/listinfo/product-developers

Reply via email to