I disagree<br>This is not a flaw in schema.List<br>your usecase is to make it persist. But, it&#39;s the unique usecase of a form.<br>However, a simple list is persistent, just doesn&#39;t trigger an update warning for the ZODB if modified.<br>
<br><div class="gmail_quote">2009/8/26 Sebastian Ware <span dir="ltr">&lt;<a href="mailto:sebastian@urbantalk.se">sebastian@urbantalk.se</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
A bug in applyData when I come to think about it... so I filed it :)<br>
<br>
Mvh Sebastian<br>
<div><div></div><div class="h5"><br>
On 26 aug 2009, at 17.36, Sebastian Ware wrote:<br>
<br>
&gt; That is true, however I would definitely call that behaviour a bug in<br>
&gt; schema.List. The assumption that only data manipulation is done with<br>
&gt; applyData sounds risky. You could get some pretty creepy bugs...<br>
&gt;<br>
&gt; Anyway, I&#39;ll look into your suggestion.<br>
&gt;<br>
&gt; A suggestion is to change the behaviour of applyData so that it<br>
&gt; returns PersistentList.<br>
&gt;<br>
&gt; Mvh Sebastian<br>
&gt;<br>
&gt; On 26 aug 2009, at 17.25, Leonardo Rochael Almeida wrote:<br>
&gt;<br>
&gt;&gt; IIRC, It is only a problem if you try to modify the list itself<br>
&gt;&gt; directly (like appending to, or extending the list,  or removing or<br>
&gt;&gt; replacing items or slices in the list). schema.List returns a new<br>
&gt;&gt; list<br>
&gt;&gt; for every form submission, instead of trying to alter the old list to<br>
&gt;&gt; include the new items. This new list is assigned to the object during<br>
&gt;&gt; applyData, so it will be persisted correctly.<br>
&gt;&gt;<br>
&gt;&gt; On the other hand, it&#39;s very easy to create your own class that<br>
&gt;&gt; extends from schema.List to return your own datatype. IIRC you only<br>
&gt;&gt; have to override one attribute in the subclass, and it will receive<br>
&gt;&gt; the same widgets as the superclass unless you register differently or<br>
&gt;&gt; alter the implemented interfaces.<br>
&gt;&gt;<br>
&gt;&gt; Cheers, Leo<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Aug 26, 2009 at 11:56, Sebastian<br>
&gt;&gt; Ware&lt;<a href="mailto:sebastian@urbantalk.se">sebastian@urbantalk.se</a>&gt; wrote:<br>
&gt;&gt;&gt; Lists need to be implemented as PersistentList in order to be<br>
&gt;&gt;&gt; automatically persisted to ZODB, however schema.List returns an<br>
&gt;&gt;&gt; ordinary list and applyData seemingly stores this list as is. Isn&#39;t<br>
&gt;&gt;&gt; this a big problem?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    tags = schema.List(title=u&quot;Content Tags&quot;,<br>
&gt;&gt;&gt; value_type=schema.Choice(title=u&quot;Content Tag&quot;,<br>
&gt;&gt;&gt;           vocabulary=&#39;Content Tags&#39;), default = [])<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Mvh Sebastian<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Grok-dev mailing list<br>
&gt;&gt;&gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt;&gt;&gt; <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
&gt;&gt;&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Grok-dev mailing list<br>
&gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt; <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
<br>
_______________________________________________<br>
Grok-dev mailing list<br>
<a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
</div></div></blockquote></div><br>