Re: Object created events
Martin Aspeli <[email protected]> Mon, 02 Oct 2006 00:35:01 +0100
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
Kapil Thangavelu wrote: > i was thinking the autogenerated factory/constructor stuff in at tool, > custom factories would need to be updated if they wanted to generate this > event. Okay, I've done precisely this, on the 15-schema-refactoring branch, to go along with the event-based validation and schema adapterisation (and also to save me from having to modernise AT's test setup in more than one place, when Whit already did it on that branch). We have: - IObjectCreated event is being fired during the generated constructor --> I don't know how to write a test for this, though, so it's currently untested :-( - IObjectInitializedEvent and IObjectEditedEvent both inherit from IObjectModifiedEvent, and are being fired in processForm() when the object is first edited (creation flag is set) and when it's subsequently edited. This retains compatibility with current 1.4 behaviour where only IObjectModified event is being fired in processForm(), but also lets you register different subscribers if you truly need to differentiate between first-save and subsequent-edit. There are tests for everything except for the created event. Writing that test is not hard, but I don't know to properly invoke the generated constructor on my dummy content object. Also - this branch is now probably ready to be merged into 1.5 (which Nouri already gave the nod for). It brings benefits of test framework improvements (to make it easier to test things that use the Z3 CA), as well as the schema-by-interface stuff, the validation events and the above events. There are two test failures, which are also there on the plain 1.5 branch and relate to WebDAV, otherwise things are tested and working. I've also done real-world tests against ContentFlavors and it seems to work nicely. Martin ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV