Re: Re: improving 'BaseObject._renameAfterCreation'
Alec Mitchell <apm13-WLbs8XpHrcb2fBVCVOL8/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wednesday 04 January 2006 07:53, Rocky Burt wrote: > Martin Aspeli wrote: > > -0.5 on more magic hooks in AT (until we have an events system or such, > > yeah, I know, heard it before). ... > > I was thinking it'd be nifty to simple use z3 events (via five) to watch > your content type IObjectModified events and then use the subscriber to > fix the id accordingly. But then it occurred to me that since this is > done out-of-thread, the 'edit' screen for the content type after having > been just submitted may or may not be finished in time to send the > browser to the renamed id. In other words, it wouldn't be reliable and > couldn't be depended on. Anyone have a thought on how this could be > made to work? Perhaps I'm overlooking something simple? Ideally object creation would happen in a more z3 schema-ish way, so that at least a core set of attributes would be edited before object creation. During object creation an INameChooser adapter for the container can be used to generate the title from the entered value, either triggered by an ObjectCreatedEvent, or done explicitly in the Adding code. The latter method is the default for Five's Adding view, and is used in plone_schemas to do optional title -> id auto-renaming for z3 schema objects that want to be included in plone. Alec ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click