-*- text -*- Module Modeling --------------- Current release is: 0.9 / See also: TODO, INSTALL and doc/ ** Distributed under a 3-clause BSD-style license, see LICENSE for details ** ----------------------------------------------------------------------------- 0.9 (2006/02/26) ---------------- * Now distributed under a 3-clause BSD-style license, see LICENSE for details * Fixed bug #918115: tests were failing under py2.1 w/ ZODB was installed, plus: relationships equality was not behaving as expected under py2.1 and 2.2, because these versions of python use __cmp__ rather than __eq__ * Fixed: Attribute.convertStringToAttributeType() failed when python db-adapters, such as mysqldb, already return values under the a date type * Fixed a serious problem occuring in multi-threaded environment: unexpected failures happened when an EC was fetching objects while another had a faulted object which was concurrently fetching its own values. * Fixed: DatabaseChannel.fetchObject(): it was possible for a snapshot to be cleared from the cache while initializeObject() was in progress (this could happen when another EC was garbage-collected in another thread e.g.) This happened because at this point, the database's lock is released. To prevent the problem, the snapshot's count is incremented before releasing the database's lock, and decremented only after initialzeObject() has returned. * Documentation: added full documentation concerning: 1. the static generation, or the dynamic building of python package and modules from a model, 2. the requirements the framework imposes on python modules and classes. * Script mdl_generate_python_code.py - does not create the empty files TODO.txt, README.txt, VERSION.txt, INSTALL.txt, DEPEDENCIES.txt anymore - now detects whether it is called with an xml- or a py-model and, in case it is called w/ a pymodel, it copies it into the generated module (it was previously only generating the files for the xml-model, no matter how it was called) * Fixed bug #1032577: undetected syntax errors in qualifier strings. Thanks to Marcos Dione for the report * Fixed bug #981123 reported by Ernesto Revilla: dynamic.build() now accepts PyModels In the same method: also fixed the generated module's '__name__', and added attribute '__module__' to the generated classes * Fixed bug #1008615: disabled the FutureWarning raised by python2.3 for negative value in hex(). Thanks to Lorenzo Gil Sanchez for reporting. * Applied patch #1040045 submitted by John R. Lenton --typo corrections in the documentation * Applied a patch contributed by Lorenzo Gil Sanchez, fixing a bug where a valid model could be rejected by mdl_generate_DB_schema.py cf. https://sf.net/mailarchive/forum.php?thread_id=5660203&forum_id=10674 Thanks! * Fixed bug #994403: both scripts mdl_generate_DB_schema.py and mdl_generate_python_code.py now abort when the model contains errors, unless option '-f-'/'--force' is set. * Fixed bug #916019: FetchSpecification did not detect when an entity has no ClassDescription (usually meaning either a typo or a model not loaded yet), but assumed that one exists in setQualifier() --leading to an error in Qualifier.validateKeysWithRootClassDescription() that was not informative at all for the developer. * Fixed bug #813586: Attribute's field 'usedForLocking' is not documented * Fixed bug #1023234: PyModel fails to validate to-many relationships in associations where the upper bound is a finite number (for example: 2) * Fixed bug #938096: QualifierParser fails when an attribute's name begins w/ a keyword, such as AND, OR (e.g. attribute 'origin'), etc. * EditingContext.faultForGlobalID(): parameter anEditingContext now defaults to self * Added missing support for mx.DateTime.Time, as requested by Ernesto Revilla --patch posted on the ml the 29th Feb 2004. * Fixed bug #918095: tests/run.py fails if neither psycopg, pgdb or pygresql is installed * Fixed bug #918103: infinite loop when spark is not installed 0.9-pre-17.1 (2004/02/22) (last version under the GPL, next releases ------------------------- are under a 3-clause BSD-style license) * Fixed bug #902106: impossible to load a model if ZODB is installed. NB: useless module Modeling.Persistent removed. * Fixed bug #902209: mdl_generate_DB_schema.py silently exiting when no commands are provided on the cmdline; this could be variously misinterpreted. The script now correctly reports this as an error. 0.9-pre-17 (2004/02/17) ----------------------- * Integrated patch #814055: Dynamic creation of packages/modules/classes. Not publicly announced, it is not documented yet. Till then, the file doc/README.dynamic.txt contains further details. * MySQL: - added DOUBLE to the list of supported SQL types - fixed the generation of primary keys: two threads could get the same id * Applied patch #771009: DatabaseContext.batchFetchRelationship() Not publicly announced because it's not documented yet --and there a need for a more user-friendly API at the EditingContext level! * ObserverCenter: internals changed: no more variables or functions whose names are surrounded by double-underscores (these names are normally reserved for python use) * Updated the files to conform to PEP-0263: source encoding is iso-8859-1 * Fixed SortOrdering.sortOrderingsWithString() * Added missing Modeling.__version__, thanks to John Lenton for noticing. * Env. variable MDL_PERMANENT_DB_CONNECTION is now deprecated and has no effect anymore. It has been replaced by MDL_TRANSIENT_DB_CONNECTION which has the inverse semantics --see the User's Guide, appendix Environment Variables, for details. * Fixed bug #880862 using a patch submitted by John Georgiadis (thanks!): XML exported under py2.3 cannot be imported back because of boolean values 'True' and 'False' not properly handled. * MySQL: the model's connection dictionary may now give a specific port to connect to. * Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed FlattenedRelationship.__eq__ * Fixed bug #862182: Validation refusing valid relations between objects (TODO: tests units for this) * Fixed bug #861048: Invalid FK constraints in generated DB schema Added scripts/bug861048.py that you can run against your model to check if the corresponding generated database schema was affected by the bug. If it is, the script will tell you what should be done to fix it. * Fixed bug #857803: mysql: invalid generated sql for complex qualifiers --some qualifiers led to invalid SQL when fetching, causing SyntaxError. * Fixed bug #847212: qualifier IN does not handle correctly strings (strings were not quoted as they should be) * Fixed bug #854630: an empty qualifier string made ec.fetch() fail * Fixed bug #813297: mdl_generate_db_schema fails for SQLite and -A (fixed in 0.9pre16 but it was not announced) 0.9-pre-16 (2003/11/16) ----------------------- * Fixed bug #839231: python code generated in -B/--base mode made it impossible to import a class having sub-classes at first (it was raising because of circular imports). * Fixed bug #842698: when a PyModel.Attribute property is set after instanciation, its value was never propagated to the final Attribute at build() time. * Fixed bug #841315: PyModel associations do not set the multiplicity bounds e.g. a toOne relationship was always [0,1] regardless of what the definition of the Association. * RFE #812708: mdl_generate_db_schema.py now automatically adds a semi-colon (';') when option '-c' is enabled. A new option (-e/--end-with) is added to control this behaviour. In particular, the old behaviour (no semi-colon at end of statements) can be still obtained by supplying an empty string to option -e/--end-with (-e "" or --end-with ""). * Fixed bug #812671: utils.finalize_docstrings() disabled * Fixed bug #814007: KeyValueCoding.storedValueForKey() unexpectedly returned obj.key instead of obj._key when both exist. * Fixed bug #785434: When mdl_generate_db_schema is run with an option which doesn't require the admin-dsn to be set, the script fails with a KeyError. 0.9-pre-15 (2003/09/13) ----------------------- * Fixed bug #804756: EditingContext.insertObject() appeared to be really slow when resolving dns entries is slow. Hence TemporaryGlobalID is now caching the FQDN on a per-session basis. * Generated python code: __init__() now takes a keyword argument **kw, allowing new objects to be initialized with values. Ex: b=Book(title='t') 0.9-pre-14 (2003/08/31) ----------------------- * Documentation: - documentation for models in general has been rewritten. In particular, PyModels are now fully documented - instructions for modeling and manipulating many-to-many relationships have been added in the User's Guide. * PyModel.Model: - Fixed bug #795561: __init__() did not recognize 'version' as a parameter - Fixed bug #794185: Entity.__init__() ignores associations - Now raises PyModel.IncompatibleVersionError when a model has an incompatible version (was: ValueError) * Fix for bug #785432 included in the previous release was misplaced and inactive. Fixed. * SQLExpression: added support for joinClauseString(), which offers an alternative when the underlying db-server does not support SQL JOIN statement. * Full support for Oracle database: added OracleAdaptorLayer (do not use now, there are still commits). Test units updated. 0.9-pre-13 (2003/08/10) ----------------------- * Added an installation guide * Fixed bug #785913: "LIKE qualifier w/ raw '%' and '_' characters does not work w/ SQLite" * Fixed bug #786217: 'Qualifier LIKE can be case-insensitive' (bug was observed for MySQL and SQLite) * Fixed: Postgresql Layer can now correctly handled raw '_' characters in a LIKE statement * Fixed bug #785432: SQLite now accepts TEXT, and DATETIME, TEXT, NUMBER, DECIMAL, SMALLINT, REAL as well in addition to the sql types basically accepted by the core's SQLExpression (CHAR, FLOAT, INT, INTEGER, NUMERIC, DATE, TIME, TIMESTAMP and VARCHAR) * Fixed bug #785434: mdl_generate_DB_schema now detects when the database (file)name in dsn and in the admin-dsn are not the same. 0.9-pre-12 (2003/08/03) ----------------------- * Fixed bug #780495: when ec.fetch() is joining two tables or more, the returned set of objects could have duplicates. * Fixed bug #774989: improper result returned by CustomObject.snapshot() wrt tomany relationships --see CustomObject.snapshot() documentation for details. * Fixed bug #779775, on behalf of Yannick Gingras who reported the bug and gave the patch fixing it. * Fixed bug #781884: SQLiteAdaptorLayer: dropping and creating a database was not possible (and was failing w/ an ugly traceback) * Fixed MANIFEST.in and setup.py: the SQLite adaptor layer was omitted in the source distribution! Thanks Mario for reporting. * Model.loadModel() now automatically build() a pymodel, as suggested by Mario 0.9-pre-11 (2003/07/28) ----------------------- * Removed the constraint on to-many relationships for which an inverse to-one relationship had to be defined. Details: recordChangesInEditingContext() refactored, recordUpdateForObject() implemented, model StoreEmployees changed. * Added Relationship.anyInverseRelationship() --plus entity Holidays in test model StoreEmployees, with a toMany rel. Employee-->Holidays having no inverse. This is the first step towards the removal of the constraint on to-many relationships that should have an inverse toOne rel. for the moment being. * Fixed bug #776996: RelationshipManipulation methods misbehaving w/ inheritance. Implied fixing: Relationship.inverseRelationship(). Also added: entity.parentEntities() * Fixed bug #776592: was impossible to add raw '*' and '?' characters in a LIKE statement * Simple methods for models, entities, attributes, relationships and ClassDescriptions can now be automatically cached. This speeds up operations where model introspection is needed (when saving changes, when using RelationshipManipulation interface, etc.). See Appendix A.1, "Environment variables / Core" in the User's Guide for details. * Module RelationshipManipulation has been optimized and is now about 1.2x faster (2x faster with caching of models and class descriptions, see above) * Model, Entity, Attribute, Relationship, Join: replaced 'Unimplemented' exception with NotImplementedError * Added documentation: handling custom types for attributes (2003/07/21) 0.9-pre-10 (2003/07/18) ----------------------- * Fixed bug #772997: deleted then re-insert objects not correctly handled. * Added the ability to fetch raw rows (dictionaries instead of fully intialized objects) --see FetchSpecification.setFetchesRawRows() and EditingContext.fetch() 's parameter 'rawRows'. Also added the possibility to turn these rows into real objects --see EditingContext.faultForRawRow() Documentation updated. * Added CustomObject.snapshot_raw(), support for the future ability to fetch raw rows (see above) * rewrote trace() statements in QualifierParser to avoid the unnecessary formatting of its arguments when it is not enabled. On my machine this speeds up the parsing of qualifiers strings up to x7. * Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', 'OR' and 'NOT' can now be written with lower-case characters. [Merged branch brch-0_9pre7-1-PyModel] Note: PyModels are not officially announced w/ this release, because there's no documentation yet. See mailing-list archives for details, or go there and ask. * Fixed: adaptorModel() could raise instead of returning None when model's adaptorName is not set * Model: added updateModelWithCFG(), loadModel(), searchModel() ModelSet: DEPRECATED method: updateModelWithCFG() --moved in Model, will be removed in v0.9.1 * Added Modeling.PyModel and Modeling.tests.test_PyModel * Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py and updated StoreEmployees/__init__.py: now loads the model from the PyModel * Changed ClassDescription's delete rules: constants DELETE_CASCADE, DELETE_DENY, DELETE_NULLIFY and DELETE_NOACTION are now strings (were: integers) --> Relationship.setDeleteRule() updated to accept old integer values (backward compatibility) 0.9-pre-9 (2003/07/04) ---------------------- * API change (see mailing-list archives): Added EditingContext.insert(), delete(), fetch(), fetchCount(), autoInsertion(), setAutoInsertion(). Added CustomObject.globalID(). Added KeyValueCoding.valuesForKeys(). DEPRECATED methods KeyValueCoding.setValueForKey(), setValueForKeyPath(), setStoredValueForKey() (will be removed in v0.9.1) * Added SortOrdering.sortOrderingsWithString() * documentation: added Project's status page, and contributors. Moved the section on KeyValueCoding and RelationshipManipulation to an 'advanced techniques' part. Added raw material about fetching and inheritance. Updated to reflect the API change. * Fixed: ModelValidation does not issue an error anymore when a model contains a CHAR/VARCHAR field with no width set, as long as the underlying adaptor supports it (varchar w/o width are valid for: Postgresql, SQLite), as Ernesto Revilla suggested it. Instead, it produces a message at the INFO level. * Fixed bug #757181: under python2.2 AccessArrayFaultHandler was triggered every time the array is accessed, instead of being fired only once. * Fixed: adaptorModel() could raise instead of returning None when model's adaptorName is not set * Fixed: PostgresqlSQLExpression was not correctly escaping '%' (postgresql interprets the backslash char just like python does, hence escaping '%' requires a double backslash in the SQL query) * Fixed bug #753147: fetching twice or more with a given FetchSpecification did not return the same result set (the original FetchSpec was modified) * New adaptor layer for SQLite * Fixed Entity.externalNameForInternalName(): when used with names containing figures (such as i 'db2Id') externalNameForInternalName(nameForExternalName()) was not idempotent Applied a patch submitted by Yannick Gingras. Thanks! * REMOVED dependency for 4Suite (was in 0.9pre8, forgot to announce) * 'TEXT' field now accepts a width to be set (ignored when generating the database schema, but checked, if set, when validating an attribute's value) * Added 'TEXT' as a valid sql datatype for the Postgresql adaptor * Added keyword 'ilike', short for 'caseInsensitiveLike', for qualifier string definition * Fixed: the User's Guide as pdf failed to print for acrobat reader v4+, because of hyperlinks. Thanks to Ernesto Revilla for reporting and identifying the problem. 0.9-pre-8 (2003/05/27) --------- * Loading a xml-model is now 5 to 6x faster: applied a patch submitted by Yannick Gingras . Thanks! * Fixed: creating/dropping a database could fail because of trying to rollback a cursor in autocommit mode [Merged from brch-0_9pre6-1-ModelMasons_base_generation_scheme] Summary: the ''base'' generation scheme has changed. Instead of putting Writer.py and WriterBase.py in the same package, it now generates a subpackage 'MDL' in which the base classes are dropped. * Added tests/test_generate_python_code.sh: tests the generation of python code in different situations, and it also checks that the appropriate python test (such as test_EditingContext_Global.py) succeeds with the generated code. Also added: xmlmodels/model_StoreEmployees.xml[2|3] * Updated documentation for ModelMason and PyModelMason * Added fake_mode to ModelMason, PyModelMason and option -n/--dry-run in mdl_generate_python_code * scripts/mdl_generate_python_code (option -B), PyModelMason.checkModelIsValid()): the 'base' scheme cannot generate a python-package from a model where a class and at least one of its (direct or indirect) subclasses leave in the same module. This is now checked and correctly reported when the generation cannot be done. * Added the 'MDL' sub-directory containing the files that are overwritten when mdl_generate_python_code.py (option: -B) regenerates a package [/merge] * RFE #726839: Added environment variable MDL_DB_CONNECTIONS_CFG; it points to a single ini-file which centralizes the sensitive informations contained in each model's database connection dictionary (username, password). See tests/Postgresql.cfg for an example. 0.9-pre-7.1 (2003/05/08) ----------- * Forgot to include mdl_compile_model.py 0.9-pre-7 (2003/05/06) --------- * Fixed DatabaseChannel.fetchObject(): it was not MT-safe wrt Database snapshots' caching in some circumstances (see comments in the code for further details) * Added scripts/mdl_compile_model.py and update the __init__.py generated by mdl_generate_DB_schema.py so that it automatically tries to load the pickled model. Using the pickled model is *much* faster than loading the model from its xml description. * Fixed AbstractDBAPI2Adaptor.create/dropDatabaseWithAdmin.Conn.Dict.(): under some circumstances it was possible that createDB() fails when called just after the drop, fails (see comments in the code for details) * Fixed mdl_generate_DB_schema: some options ('-t -p -s -f -F) were silently ignored * Added a field 'comment' for Model, Entity, Attribute & Relationship, after a suggestion by Yannick Gingras 0.9-pre-6 (2003/04/22) Project milestone -- no public release --------- * ModelMasons: added a new generation scheme. The existing one is named 'compact', the new one, 'base'. The latter generates two different modules for a given entity, in modules (which is not overwritten when re-generating) and Base (which IS overwritten upon regeneration) * Refactored ModelMasons: ModelMason and PyModelMason are now clearer than they used to be. See PyModelMason for an example of use. Fixed: bug #710817 Fixed Python_bricks/module.tmpl: do not generate e.g. setId() if 'id' is a primary key marked as a class property * Fixed: name clash for invalidatesObjectsWhenFinalized in EditingContext Default behaviour is now set with EditingContext.invalidatesObjectsWhenFinalized_default * Fixed: an newly inserted object with a PK, say, 'id', marked as class property did not get its value after EditingContext.saveChanges(). [Details in: EditingContext.handleNotification()] Thanks to soif for identifying and reporting the pb. * Fixed SQLExpression.sqlStringForAttributeNamed(): now raises ValueError with an explicit message when it receives an invalid attribute's name 0.9-pre-5 (2003/03/17) Project milestone -- no public release --------- * Attribute: fixed defaultValueAsPythonStatement() and convertStringToAttributeType(): they were failing to operate properly under python2.2 (StringType.__name__ is 'string' for py2.1, 'str' for py2.2) * Fixed Entity.objectsPathForKeyPath(): under some circumstances it did not raise ValueError as expected for an invalid keypath * scripts/mdl_validate_model.py fixed: ValueError could be raised when no messages were issued at the INFO level * Fixed ModelValidation.validateEntity_internals(): now iterates on all primary keys, and correctly report an error when a PK is set to be a class property but does not have a default value set to integer zero (this is now enforced since when the default value is None, we get an erroneous error message at EC.saveChanges(): the validation mechanism fails on validating the PK --thanks to Yannick Gingras for reporting the problem) * Fixed Attribute.initWithXMLDOMNode(): it was possible that the defaultValue was set prior to the attribute's type, hence it didn't get the right value (e.g. a default value being string '0' instead of integer 0 for a type=='int') 0.9-pre-4 (2003/03/14) Second release candidate for 0.9 --------- * Documentation: - The web-site has been reviewed and re-organized, thanks Mario! - Added chapter ''Integration in an application'' to the User's Guide * EditingContext + saveChangesInEditingContext(): now locks 'self' before proceeding, so that two nested \class{EditingContext} which have the same parent and are managed by two different threads can concurrently save their changes to their parent without explictly locking it. (this is logical since a EC is supposed to perform any of its operations safely in a multi-threaded environment --given that it's not shared between threads, obviously) + Fixed objectsWithFetchSpecification(): when a nested EC asks for objects, the result set now correctly includes objects that are inserted in its parent (or grand-parent, etc.) and objects that are marked as deleted in the parent are excluded. See also: tests.test_EditingContext_ParentChild, test_10_child_gets_newly_inserted_objects() and test_11_child_doesnt_get_deleted_objects() * Added Modeling.utilities.EditingContextSessioning (also added ZEditingContextSessioning, see ZModeling) * Changed _invalidatesObjectsWhenFinalized to invalidatesObjectsWhenFinalized, and made it a class member. Added documentation on this, see the User's Guide, section ''Discarding changes: details on the destruction process of an EditingContext'' (doc/UserGuide/ManipulatingGraphOfObjects.tex) * Added 'TEXT' as a valid sql datatype for the MySQL adaptor * Proposed a fix for bug #614261: because of mysql having a strict syntax for sql statements containg JOINs, the default statement produced by SQLExpression led to a syntax error as soon as the supplied qualifier contained a keypath referencing two or more entities, such as in 'pygmalion.books.title'. The bug-item is not closed, waiting for people using the mysql adaptor to confirm it behaves as expected. See also: test_EditingContext_Global.test_14_qualifierWithNullValue() & test_11_allQualifierOperators() * Bug #699046: when an invalid sql data type is encountered at runtime, the message is now much more informative than it used to be (i.e. it now indicates clearly where the error comes from) cf. SQLExpression v1.14 * Bug #699272: Fixed DBChannel.selectCountObjectsWithFetchSpecification: was not closing the underlying adaptorChannel when finished Related tests added: in test_EditingContext_Global.py, test_01c_objectsWithFetchSpecification_closes_adaptorChannel() test_13b_objectsCountWithFetchSpecification_closes_channel() Note: this made a bug triggered in psycopg when two threads are using the same cursor more likely to happen (when used in Zope e.g.) See discussion at http://lists.initd.org/pipermail/psycopg/2003-March/001885.html 0.9-pre-3 (2003/03/02) Release candidate for 0.9 --------- * Added documentation for nested EditingContexts * Fixed bug #690224: EntityClassDescription.classForEntity() raised UnboundLocalError instead of ImportError when the module identified by 'packageName.moduleName' is not found. The message raised along w/ ImportError is now more informative (added a new test in tests.test_EntityClassDescription) * Fixed bug #695671: ModelValidation does not detect INTEGER(width) (same for precision and scale) * optimization of ModelSet.addModel(): it now iterates on its own entities only once, not for each entity of the added model 0.9-pre-2 (2003/02/23) --------- This release is known to be stable in two different production environments for about 4 months now. Full description of these environments will be publicly released with v0.9. * Feature Request #617997: "Nested EditingContexts" Added/Implemented: isaChildOf(), saveChangesInEditingContext() Modified: faultForGlobalID(), initializeObject() Documentation for this feature will be available when 0.9 is released. In the meantime users can refer to tests/test_EditingContext_ParentChild.py for example of use. While committing the changes I noticed that two bugs might exist in a very specific situation --i.e. when an object is inserted then deleted in an EC, provided that ec.saveChanges() is not called in the meantime. See the announce on sourceforge's mailing-list for more details. 0.9-pre-1 (2003/02/23) Project milestone, CVS-tagged but no public tarball --------- * EditingContext and related changes in DatabaseContext: [committed in EC v1.15 and DBContext v1.13] - Fixed deleteObject(): it failed when called on an previously inserted object (inserted, but not saved): 1. _insertedObjects was not examined, only _pendingInsertedObjects, and 2. deleting an inserted object wrongly registered it in the list of deleted objects, instead of simply forgetting it. - Updated docstrings for (all)inserted/updated/deletedObjects() - Changed: objectsWithFetchSpecification(): the result set now includes inserted objects even if they have not been saved yet ; it also does not include any more the objects that have been marked for deletion. This makes this method reflect the changes made in the EditingContext rather than the sticking to the database state. Similarly, DatabaseContext.objectsWithFetchSpecification() does NOT take anymore about deleted objects in the calling editing context. This participates of the same logic: a DBContext has no internal state and should not be aware of any changes made in an ObjectStore somewhere higher in the ObjectStore hierarchy. cf.: test_01b_objectsWithFetchSpecification_and_insertObject in test_EditingContext_Global - GlobalIDChangedNotification is now correctly used for notifying observers that an inserted object as been saved, thus has received a KeyGlobalID in remplacement for its TemporaryGlobalID. Changes made in: - EC.recordChanges(): register the EC as an observer - EC.handleNotification() - DatabaseContext.finalizeCommitChanges() posts the notification, when appropriate, instead of doing the real job on behalf of the EC. - Implemented: ownsObject() * CustomObject: fixed snapshot(): now raises ObjectNotRegisteredError when the object is not registered in an EditingContext, or if at least one of the objects it is in relation w/ is not known to the object's EC. + Implemented: updateFromSnapshot() * doc/ + HomePage: removed the frames and replaced them with a html table + Added API for Modeling and Notification (online+tarballs), generated by epydoc 0.8.6 (2003/02/21) ----- * doc/ Committed changes on abstract.tex & UserGuide's CustomObject.tex, DefiningaModel.tex and ManipulatingGraphOfObjects.tex on behalf of Mario Ruggier who reviewed, corrected and enhanced the documentation. Thanks a lot! + HomePage/ re-organized (this part is used to generate the w3 site http://modeling.sourceforge.net) * DatabaseContext: Fixed: adaptor channels are expected to be closed when any of the following operations terminates: fetch (ec.objectsWithFetchSpec), insert, update or delete (ec.saveChanges). The later (saveChanges()) did not close the underlying adaptorChannel. (see tests.test_AdaptorLayer.test_01_adaptorChannels_are_closed() and DatabaseContext._endTransaction()) * Database Adaptors: + AdaptorChannel API: modified the contract for closeChannel(): an already closed adaptor channel should not fail when receiving the closeChannel() message --however in this situation adaptorChannelDidClose() should not be sent to the AdaptorContext. + AbstractDBAPI2AdaptorContext.adaptorChannelDidClose(): now closes the db-connection when closing the last opened AdaptorChannel. This behaviour can be changed by setting the environment variable MDL_PERMANENT_DB_CONNECTION. + fixed PGAdaptorContext.adaptorChannelDidClose(): do not try to rollback a db-connection which has been already closed. * DatabaseChannel.cancelFetch(): forgot to close the underlying adaptor channel. Fixed. * environment variables are now prefixed w/ 'MDL_': MDL_POSTGRESQL_SERVER_VERSION, MDL_ENABLE_DATABASE_LOGGING, MDL_PREFERRED_PYTHON_POSTGRESQL_ADAPTOR * DatabaseContext: - fixed arrayFaultForGlobalID() signature which did not follow the specification of interfaces.ObjectStoreInterface - fixed performChanges(): it was possible for a toMany snapshot stored in object Database (responsible for snapshots) to get out-of-sync with the database, when an object got no modification but in one (or more) of its toMany-relationships. After it occured, any other EditingContext was obtaining that out-of-sync toMany snapshot and when it was triggered, the framework did try to fetch, for the best, an object that still exists but shouldn't be related, for the worse an object that was removed from the database. (see also: comments left in the source) (specifically tested in: test_EC_Global.test_16_toManySnapshotsUpdated) 0.8.5 (2003/02/10) ----- * EditingContext: - added: exception ObjectNotRegisteredError now raised by: deleteObject() - added: allInsertedObjects(), allUpdatedObjects, allDeletedObjects() see docstrings for details - implemented: arrayFaultWithSourceGlobalID() - UniquingTable: added support for ``root GlobalID'', and fixed addObjectForGlobalID(), forgetObject(), forgetObjectForGlobalID(), hasObject(). This fixes the following bug: when a relationship to an entity having a parent entity was triggered, it was possible to get a fault instead of the real object (when that object was already set). Cf. test_EditingContext_Global_Inheritance.test_05b_toOneFault_uniquing for more detail Note: this bug is only triggered by a given sequence of events, when different relationships point to different entities which are parents/children. * Relationship.SimpleRelationship: - validateValue(): validation of a value being a fault now immediately succeeds and returns. We do not want to trigger faults when validating the values, faults are considered okay wrt. the validation logic. - setMultiplicityUpperBound() now accepts '*' for -1 (unconstrained toMany relationships) * ObjectStoreCoordinator: - fixed arrayFaultWithSourceGlobalID() which was not returning any value - Followed the change in the ObjectStore API: now implements ownsObjects() instead of handlesObject(). - Misc: fixed a typo in saveChangesInEditingContext()/error msg. when changes are rolled back" Modeling/ObjectStoreCoordinator.py * QualifierParser.qualifierWithQualifierFormat: now allows upper-case for the first character in a key (e.g. "AGE == NULL") (see also tests.test_Qualifier.test_07_qualifierWithQualifierFormat4) * GlobalID: fixed KeyGlobalID.keyValues(): was returning the internal dictionary, making it possible to inadvertently change its read-only state. * Entity: Added: (module) primaryKeyForGlobalID() (class) primaryKeyForGlobalID() and primaryKeyForRow() +Some docstrings now uses utils.finalize_docstrings * Adaptor: Added CannotSerializeException. adaptorWithName() now includes the traceback in the message of exception AdaptorImportError when an adaptor cannot be loaded' * tests: fixed test_Model.py (could not run individually, missing import) 0.8.4 (2003/02/04) ----- * Added script: mdl_generate_python_code * Renamed scripts: generate_DB_schema.py -> mdl_generate_DB_schema.py validate_model.py -> mdl_validate_model.py * Fixed: mdl_generate_DB_schema.py: option '-A' wrongly required '--admin-dsn=' to be set * ModelMasons.ModelMason: added verbose_mode on init ModelMasons.PyModelMason: (id.) + fixed __init__: now correctly initializes productBaseDirectory() as requested by the superclass ModelMason 0.8.3 (2003/02/02) ----- * User Guide / Chapter 2. Defining a model rewritten. The subject of this chapter is not centered on the ZModeler anymore, rather it provides a full description of the xml-format used to define a model. * Reorganized the directory Modeling/doc/ * Added: scripts/validate_model.py ModelValidation.ModelValidationException: API change: added has_errors() and levels_of_errors() 0.8.2.1 Forgot to include scripts/ in the tarball ------- 0.8.2 (2003/02/01) ----- * Added scripts/generate_DB_schema.py (-h for help) * Generation of SQL statements: (Modeling, Modeling.interfaces, PostgresqlAdaptorLayer) SchemaGeneration: the three following methods were added in the API: - dropForeignKeyConstraintStatementsForRelationship - dropPrimaryKeyConstraintStatementsForEntityGroup(s) along with their associated constants DropForeignKeyConstraintsKey and DropPrimaryKeyConstraintsKey. The SchemaGeneration.defaultOrderingsForSchemaCreation() has also been corrected (was wrong: alternation of drop+create statements instead of having drop statements come in first, then create statements in reverse-order) + PostgresqlAdaptorLayer: now correctly generates create/drop SQL statements for postgresql versions 7.2 and 7.3. Environment variable 'POSTGRESQL_SERVER_VERSION' allows you to specify with which version of the pg-server you're working with (default: 7.2) [Added for that purpose: PostgresqlAdaptorLayer.pg_utils] Note: this corrects a bug in test_EditingContext_Global.py which, when triggered with the '-r' option (recreate database), was not able to actually recreate the database for pg-server v7.3. Thank you Mario for the bug report! * Postgresql & psycopg: PostgresqlAdaptorContext/adaptorChannelDidClose() now rollbacks the underlying connnection object when using psycopg --if not done, this leads to strange behaviour because changes committed by others are never seen. * SQLExpression: changes in the set of supported SQL datatypes - SQLExpression.valueTypeForExternalTypeMapping(): Removed datetime & timestampz from the list, added date & time - Added MySQL/PostgresqlSQLExpression to the corresponding Database Adaptors Layer: Postgresql: additional supported datatypes are: 'datetime' (warning: not supported anymore for postgresql version>=7.3), 'timestamp without time zone' and 'timestamp with time zone', MySQL: additional supported datatype: 'datetime', removed datatype: 'timestamp' (see DatabaseAdaptors.MySQLAdaptorLayer.MySQLSQLExpression for a complete explanation) NB: ModelValidation has been updated to notify the problem with postgresql and 'datetime' * Database Adaptors logging: - they do not log anymore the password they use when connecting to a database (replaced by 'xxxx' so that a bug-report containing log msgs or tracebacks will not disclose the password by mistake) - it is not activated by default, except for error and fatal msgs. To activate them, set the environment variable ENABLE_DATABASE_LOGGING to any non-empty string. * Fixed Qualifier.QualifierOperatorLike and QualifierOperatorCaseInsensitiveLike: they were failing when comparing the pattern to a value which is not a string, such as an integer or a mxDateTime. * ObjectStore: Added ownsObject(), and made handlesObject() an alias for ownsObject(). * tests.test_EC_Global.test_999_customSQLQuery() fixed: it failed w/ the pypgsql adaptor --see comments in code for details. * PostgreqlAdaptorLayer & MySQLAdaptorLayer: Fixed: useless import statements in __init__ were shadowing modules PostgresqlAdaptor and MySQLAdaptor 0.8.1 ----- * Added python postgresql module PyGreSQL to the list of modules that the PostgresqlAdaptorLayer can use. The PostgresqlAdaptorLayer now checks the environment variable 'PREFERRED_PYTHON_POSTGRESQL_ADAPTOR' * Fixed MANIFEST.in: forgot to include top-level files, mainly INSTALL and DEPENDENCIES. Thanks to Mario for reporting the pb. * Fixed KeyValueCoding.valueForKeyPath: a 'map' statement was missing its second argument * misc.: GlobalID's docstrings updated. 0.8 (First distribution under the GPL) --- * Added MANIFEST.in * DatabaseAdaptors/ moved back to the Modeling/ dir. * EditingContext's new feature: it can now examine updated and inserted objects to detect the newly created objects in relation, so that they are in turn inserted into the EditingContext. CustomObject (resp.) ClassDescription has a new method to support this feature: propagateInsertionWithEditingContext (resp. propagateInsertionForObject) EC.insertObject() was consequently changed to issue a warning instead of raising ValueError when it is called with an already registered object AND EditingContext.propagatesInsertionForRelatedObjects() is true * Fixed Entity.add/remove properties: now that properties are stored in a dictionary, we need an explicit self._p_changed=1. This was causing a bug in the ZModelizationTool: changes were not persistent between two restarts or refresh. * misc.: - fixed SchemaGeneration.primaryKeyConstraintStatementsForEntityGroup() (misbehaviour when an entity has no PK) - fixed AccessArrayFaultHandler.isFault() - fixed utils.isListOrTuple(): was: causing Validation to fail, sometimes, on to-many (faulted) relationships - generated python modules: attributes and relationships are now sorted by name in the generated python (makes the diff between versions a lot easier) ; added support for DateTime field * Modeling Layer: entities, attributes and relationships are now saved in the alphabetical ordre in the XML file ; this makes a diff (between two CVS versions, e.g.) much more useful * Added None/NULL value as valid r-values in QualifierParser * Added support for KeyComparisonQualifier in SQLExpression ; example: qual=Qualifier.qualifierWithQualifierFormat('pygmalion.lastName==lastName') * Removed '=' from the list of valid operators in qualifier strings 0.7a5-1 ------- * Corrected buggy setup.py 0.7a5 ----- * Added: module ModelValidation that takes care of checking a whole model against classic mistakes. * SQLExpression: added valueTypeForExternalTypeMapping() to identify the valid SQL types (and their mapping) * Optimization: CustomObject (caches its classDescription), ObserverCenter (CVS v1.5), Entity/Attribute/Relationship (optimized attr./rel.Named()) Approximative gain for E.C.inserts+saveChanges: 25% 0.7a4 ----- * Fixed QualifierParser.QualifierScanner.t_string(): did not accept empty string as values (ex.: title="") * Fixed AccessArrayFaultHandler: did not respond to isFault(), hence Validation could fail when examining an object which holds a toMany fault * ObjectsStore.faultForGlobalID(): EditingContext now implements it, while ObjectStoreCoordinator's has been fixed. * Removed dependencies from package inQual.utils --and included its module 'delegation' in the distribution, with authorization of its copyright holder * DatabaseAdaptors are now available as Modeling.DatabaseAdaptors * Added 'DATETIME' to the list of supported SQL type * Fixed Attribute.validateValue(): now considers that 'int' and 'long int' types are equivalent. * Fixed a silly bug in DatabaseContext._objectSnapshotToDBOperatorSnapshots (called by recordChangesInEditingContext): iteration on a list being modified while iterating was causing some TemporaryGlobalIDs to be recorded as toManySnapshots in Database. * Added 'objectsCountWithFetchSpecification()' to ObjectStore interface and all conforming classes (EditingContext, ObjectStoreCoordinator, DatabaseContext) --plus supporting methods: DatabaseChannel.selectCountObjectsWithFetchSpecification() & AdaptorChannel.rowCountForSelectAttributes(). * ObjectStoreCoordinator.saveChangesInEditingContext(): exception raised in case a problem occurs with the underlying db adaptor(s) now holds a more explicit message (it was just raising RuntimeError with no further indication) * Validation: error messages are now more explicit (at least, they present the object on which the validation failed) * Fixed DatabaseChannel.fetchObject() and FaultHandler.AccessFaultHandler: the way faults were resolved was buggy ; it was failing miserably when the corresponding object's class is in a class hierarchy. That mis-behaviour was also propagated to other instanciated EditingContexts. * Fixed SortOrdering: was failing when called with compound keyPath (such as 'attribute1.attribute2') * Fixed Relationship.validateValue() which was failing when supplied value was a list [tuple was ok] * Python-code templates generation now includes a 'setup.py' * Fixed DatabaseContext.availableChannel(): a stupid mistake caused a DatabaseChannel, and, hence, an AdaptorChannel [i.e. a new connection to the DB] to be created each time the function was called. * Fixed bug #599602: EditingContext.processRecentChanges() was marking a deleted object as 'updated' as well --this occurred when the deleted object has at least one relationship marked as 'DELETE_NULLIFY'. * Added logging module: a central module where all logging methods used in the framework are declared. Special methods 'db_' specifically log all actions that are forwarded to a concrete database connection. * Support for python2.2: Fixed Attribute.py and ObserverCenter.py * Fixed DatabaseChannel.fetchObject(): was incorrectly refreshing the Database' snapshot, if any, when fetching. * Fixed bug #598167: there was a possibility for a single row to have multiple faults registered in a single EditingContext ; this only occured when different entities has toOne relationship to different entities participating to the same inheritance hierarchy. * Fixed bug #598164: [KeyGlobalID] buggy computation of hash-code ; plus: explicitly made Temporary/KeyGlobalID immutable types. * Fixed module DatabaseContext's registeredDatabaseContextForModel() * Fixed buggy __set/get/delitem__ in AccessArrayFaultHandler (toMany faults) * Added ModelMasons/Python_bricks/__init__.py: stupid forgetting of mine preventing template-code to be generated, since we switched from cheetah templates (.tmpl) to cheetah compiled-templates (.py) to generate python code. 0.7a3 ----- * added full support for inheritance in the core * generation of code templates: support inheritance, support for dotted notation in Model's packageName, support for the new Entity's property 'moduleName'. * fixed a bug in DatabaseContext.prepareForSaveWithCoordinator(): was failing in some configuration when newly inserted objects were in relations with each other before being saved. * fixed a bug in EditingContext.deleteObject(): when supplied object was a fault, the propagation of deletion could be correctly achieved. Now triggers the fault prior to processRecentChanges(). * Corrected Qualifier.py and QualifierParser.py: I forgot the operator '!=' (not equal) * documentation: updated ; and its format was moved from structured-text to LaTeX * SchemaGeneration: now adds 'INITIALLY DEFERRED' to referential constraints (see docstring for foreignKeyConstraintStatementsForRelationship()) * fixed SQLExpression for 'OR' operator * fixed setup.py to cheetah-compile templates before installing: now it is fully functional 0.7a2 ----- * fixed DatabaseContext.objectsWithFetchSpecification() so that objects marked as deleted in the requesting EditingContext are not in the returned sequence of matching objects * fixed EditingContext.saveChanges(): now asks the ObserverCenter for subsequent notifications of changes on the objects it holds. Also forgetObject() after deletion has been transmitted to the DB backend. * Optimized ObserverCenter, heavily used in willChange(). Optimization factor: around 80! 0.7a1 ----- [first public release] --