<div dir="ltr">Don't you think when the new attribute is compulsory it can generate an error in default display view?<div><br></div><div>I had this problem, but I found a way by adding a migration step where I generate the new attributes on older objects.</div>
<div><br></div><div>It took me quite some time to figure out that the "default" value of a field is None if not explicitly mentioned in the schema. Moreover, the _type attribute of field can also be None (in case of Choice with vocabulary => where the default has to be mentioned, but I don't know how to force a _type then?)</div>
<div>I give you my module for you to see what I mean! (it will be on github soon ... on the ageliaco.rd2 project )</div><div><br></div><div>See you!</div><div>serge</div><div><br></div><div><br></div><div><br></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/31 Steve McMahon <span dir="ltr"><<a href="mailto:steve@dcn.org" target="_blank">steve@dcn.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">By my experience, you'll have no problem with Dexterity's default display view, which should display the default value if an attribute is missing. The problem would be with a custom template or other view. If it simply assumed that the new attribute was present, you'd get an error where it wasn't.</div>
<div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 31, 2013 at 9:00 AM, Serge Renfer <span dir="ltr"><<a href="mailto:serge.renfer@gmail.com" target="_blank">serge.renfer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you for your answer!<div><br></div><div>This means, that default view form will check if the property is present before trying to show it and :</div>
<div><ul><li>either won't show anything if it's an old object (without that property, from the previous schema)<br>
</li><li>or generating the default value for it for that object</li></ul><div>Or is it that I have to override the default view to have my own template that check properties on the object to show only the ones this object has?</div>
</div><div><br></div><div>Thanks!</div><span><font color="#888888"><div>serge</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/31 Steve McMahon <span dir="ltr"><<a href="mailto:steve@dcn.org" target="_blank">steve@dcn.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The basic answer is that you typically don't need to worry about it beyond making sure you set a reasonable default in the declaration.<div>
<br></div><div>After that, the only thing you really need to do is have some defensive coding in anything that tries to use the attribute (like a template) to do something reasonable if its absent.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Thu, Oct 31, 2013 at 12:51 AM, Serge Renfer <span dir="ltr"><<a href="mailto:serge.renfer@gmail.com" target="_blank">serge.renfer@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello,<div><br></div><div>I've been searching for doc on how to update existing objects when for example you add a property in dexterity interface!</div>
<div><br></div><div>I'm quite sure a doc exists on that matter, but I can't get a hold on it!</div>
<div><br></div><div>If any of you could give me pointers on that!</div><div><br></div><div>Thanks!</div><span><font color="#888888"><div>serge</div></font></span></div>
<br></div></div>_______________________________________________<br>
Product-Developers mailing list<br>
<a href="mailto:Product-Developers@lists.plone.org" target="_blank">Product-Developers@lists.plone.org</a><br>
<a href="https://lists.plone.org/mailman/listinfo/plone-product-developers" target="_blank">https://lists.plone.org/mailman/listinfo/plone-product-developers</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Product-Developers mailing list<br>
<a href="mailto:Product-Developers@lists.plone.org" target="_blank">Product-Developers@lists.plone.org</a><br>
<a href="https://lists.plone.org/mailman/listinfo/plone-product-developers" target="_blank">https://lists.plone.org/mailman/listinfo/plone-product-developers</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Product-Developers mailing list<br>
<a href="mailto:Product-Developers@lists.plone.org">Product-Developers@lists.plone.org</a><br>
<a href="https://lists.plone.org/mailman/listinfo/plone-product-developers" target="_blank">https://lists.plone.org/mailman/listinfo/plone-product-developers</a><br>
<br></blockquote></div><br></div>