RE: [Zope] Acquisition problem - please help
ok, now I have questions. 1. If methodX writes new values to these properties, which object gets modified? 2. Since everything is off of [one] can't I get everything through proper structuring of the url? 3. Isn't security (permissions) acquired? (see previous post about structuring large projects) 4. Can I circumvent security by structuring my url to acquire methodX from another object? Dale Lance
-----Original Message----- From: evan [mailto:evan@4-am.com] Sent: Friday, December 17, 1999 12:29 PM To: dparker Cc: evan; jkhoffman; pavlos; zope Subject: Re: [Zope] Acquisition problem - please help
Dave Parker wrote:
/one -methodX /two -propertyA(1) /three /four /five -propertyA(2)
http://host/one/two/three/four - methodX sees propertyA(1) http://host/one/five/three/four - methodX sees propertyA(2)
So the thing that doesn't jibe is that it can't *just* be the physical path - were that the case what I'm doing here would not work at all, right?
It isn't *just* the physical path, but that does have an effect. As long as you proceed from container to contained, acquisition simply looks back up the path. The moment you acquire something from above the current container, you effectively bring in the context of the acquired object. Let's break it down using 'of' for acquisition parents, and brackets to indicate that a name includes its context:
/one -> [one] -> one /one/two -> [two] -> two of [one] ... and now it gets a little tricky ... /one/two/three -> [three] of [two] -> (three of [one]) of [two] /one/two/three/four -> [four] of [two]* * Not quite accurate, it's really four of ([three] of [two]), but don't worry about it
Since methodX is a method, it doesn't add any context, so PropertyA is searched for in [four] of [two], and found in [two].
/one/five -> [five] /one/five/three -> [three] of [five] /one/five/three/four -> [four] of [five]
and PropertyA is found in [five].
Now, if 'three' had a 'PropertyA', both of the above would have found that first in [four] (/one/three/four), so to get the same results you would have to rearrange your URLs into '/one/three/four/two' -> [two] of [four] and '/one/three/four/five' -> [five] of [four].
Not to mention, if you replace methodX with DocumentX and try to put a default 'PropertyA' in 'one' then no force in the world can save you, since:
/.../DocumentX -> [DocumentX] of (...) -> (DocumentX of one) of (...)
...and you'll always search 'one' before any other folder.
If you really want a default, you need to put it a folder (such as 'three') which is *not* in [two] or [five], but *is* in [three], and ensure that 'three' appears earlier in your URLs than 'two' or 'five'.
Clear? <wink>
Cheers,
Evan @ 4-am
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
dale w lance wrote:
1. If methodX writes new values to these properties, which object gets modified?
That depends on how you modify them. There isn't any simple way to say "give me the object whose property I would acquire if I asked for 'foo'", and since you can only change a property by calling a method of the owning object... <shrug> Besides, writing is very different from reading, and with good reason. You often won't *want* to write a property on the same object from which you acquired its old value, especially if the old value is a "default" value.
2. Since everything is off of [one] can't I get everything through proper structuring of the url?
Not sure what you mean. Get every what? You can arrange your URL to give your target object whatever acquisition chain you like, but unless it is a method, it will always search its absolute path first.
3. Isn't security (permissions) acquired? (see previous post about structuring large projects)
Yep. That can be a royal pain, too, if your security arrangements are complex.
4. Can I circumvent security by structuring my url to acquire methodX from another object?
Circumvent which security? methodX will operate in the security context of your target object, but you also won't be able to acquire it unless you have permission to access it in the first place. You can never get at an any object without passing (at least) all security restrictions imposed in its absolute path. Cheers, Evan @ 4-am
participants (2)
-
dale w lance -
Evan Simpson