[Grok-dev] schema.List returns a list, but is it persistent?
uli at gnufix.de
Fri Aug 28 07:47:38 EDT 2009
Sebastian Ware wrote:
> Fair enough, this needs to be opt out or opt in. But it needs to be
I do not agree. applyData() is simply the wrong location to solve this
problem. The function leaves it to the bound fields to determine the
datatypes stored. This is the correct approach IMHO and should not be
Forcing a different datatype (possibly after a context object being
created and already changed!) is not only horribly complicated
introduces backward-compatibility problems, etc. , it also introduces
black magic behind the scene. Worse, it would introduce unreliable
magic: even with applyData changed you cannot be sure to have only
PersistentLists in context objects because the list type used with a
certain context object then depends on really having called applyData()
before. In other words, you would introduce even more subtle and more
difficult to find error sources without getting rid of your problem
So, another -1.
> As it works now there is a very real chance of data loss that hasn't
> been mentioned anywhere in the documentation. And being a framework
> that provides "sensible defaults" I think it is a bad idea to require
> setting _p_changed = True in these cases. The chance of missing that
> is huge and data loss is by far the worst thing that can happen. Even
> worse if it is subtle and infrequent.
This is a general problem of (naturally non-persistent) objects stored
in ZODB, not only of schema lists and therefore would require a
completely different approach, especially when it comes to people that
want different backends than ZODB. Certainly nothing we would like to
introduce before 1.0, would we?
Concerning only schema lists you could simply define your own schema
type with PersistentList as storage type and as already proposed by
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20090828/19c865d4/attachment.bin
More information about the Grok-dev