Johan:
<dtml-in "objectValues(['MyApples'])"> will get you the references to any apples in that folder too. It allows you to have an object in two places(being a physical distinction which matters in Zope) without duplicating the filespace and work to create a second object.
I don't quite get that? Sorry.
I had thought that Itamar's code below created an object that was exactly like the object at the URL. More like a copy. A duplicate. It that right? If so, I was thinking more along the lines of not dulplicating, just deflecting a request for an object to another object already in the ZODB.
Itamar: How about a product with only two methods in the module - manage_addMirror and manage_addMirrorForm. the form lets you choose an object somehow (by URL?) and manage_addMirror simply adds this object? Something like:
I really like a object browser, like a file browser (explorer, finder, ...) in a regular OS. Not only for this Mirror-Reference Product but general.
def manage_addMirror(self, url, REQUEST=None): """Add a Mirror """ ob=REQUEST.resolve_url(url) id=self._setObject(id, ob) if REQUEST is not None: try: u=self.DestinationURL() except: u=REQUEST['URL1'] REQUEST.RESPONSE.redirect(u+'/manage_main') return ''
What happens to the acquisition of this object? What happens if the object that this object point at gets deleted or moved? (Moved shouldn't be a problem?)
I feel strongly for a reference count or a bi-directional reference to solve the problem with reference integrity. But that would probably need a base class for referable objects to derive from.
Johan, what do you mean by reference count? Something that keeps track of all the references in the ZODB in one place. An authority? Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.