<div class="gmail_quote">On Tue, Jun 19, 2012 at 2:29 PM, Malthe Borch <span dir="ltr">&lt;<a href="mailto:mborch@gmail.com" target="_blank">mborch@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 19 June 2012 19:54, Claudiu Saftoiu &lt;<a href="mailto:csaftoiu@gmail.com">csaftoiu@gmail.com</a>&gt; wrote:<br>
&gt; That is, a function called whenever the object is loaded, that does all the<br>
&gt; necessary backwards-compatibility<br>
&gt; work right there. It separates the backwards-compat code cleanly, and also<br>
&gt; only updates the objects<br>
&gt; as-needed... though still a minor performance hit as it does the check each<br>
&gt; time the object is loaded.<br>
&gt;<br>
&gt; Is there a way to do that last option? What&#39;s the best practice for this<br>
&gt; sort of thing, in general?<br>
<br>
</div>You&#39;ll need to override ``__new__``. That&#39;s your hook. It&#39;s called<br>
when the database instantiates the object. Note that this is always<br>
true for Python. The ``__new__`` method is always called before an<br>
object is instantiated.<br></blockquote><div><br></div><div>Thanks, I wasn&#39;t aware. Seems to work - much appreciated!</div><div><br></div><div>- Claudiu</div></div>