Re: [Modeling-users] Request for testers: dynamic creation of classes from a model
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-10-05 15:52:58
|
Hi all, I've just uploaded a new patch for the new dynamic feature https://sf.net/tracker/index.php?func=3Ddetail&aid=3D814055&group_id=3D5893= 5&atid=3D489337 Changes are: - run.py testsuite has been fixed and should pass now, - dynamic.build() can now also add properties to the generated classes (when parameter define_properties is true). Hence tests have a new option -C ("classic" build w/ properties) - toMany relationships are initialized with () (empty tuple) instead of [] (empty list). Note on properties: while attributes are well handled, they can be dangerous for relationships when they are stored as list instead of tuples. For example, in the current version, author.books=3D[] is correctly handled, but author.books.append(new_book) isn't: it does not mark the object as modified, since author.willChange() is not called. For those who know zodb, the ZODB.Persistent class has the same problem in this case, and _p_changed should be manually set to 1. It is not clear to me whether a special proxy-class (deriving from types.ListType) should be specially designed for handling modifications of lists for relationships. BTW if you store relationships as tuples, not lists, then the problem disappears. -- S=E9bastien. |