Martin, First, thanks for your work on Dexterity. It seems like a great tool. Thanks for the book also. It was a great introduction to Plone for me.
I fixed the docs so they are valid RST. With respect to the schema.Dict concept outlined below... I tried making a schema as you suggested below. However, it didn't work out for me. Schema.Dict seems to be setup to contain elements which in turn have a schema, rather than having the schema itself. I felt that I was working against the framework extending schema.Dict for the row. I can still use a dict as the default implementation, but define it as Object, but this is a bit confusing. The current (0.4) version has some demo views which show both Object and Dict usage. I am a bit fluffy bere, but my interpretation is that a schema.Object defines a "MultiWidget". The MultiWidget can be implemented by an object where attributes are accessed object.attr, or as a dict where attributes are accessed as object[attr]. The List, Dict and Set are instead containers which contain rows. So I could implement the Row() concept below using an Object. I tried this, but the implementation confused me more than enlightened. Thanks for the feedback. Kevin -- Kevin Gill [email protected] www.movieextras.ie On Wed, 02 Feb 2011 22:50 +0000, "Martin Aspeli" <[email protected]> wrote: > On 2 February 2011 16:37, Kevin Gill <[email protected]> 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 [email protected] https://lists.plone.org/mailman/listinfo/product-developers
