[Zope] Problem Understanding URL
Tres Seaver
tseaver at palladion.com
Mon Jul 23 18:05:18 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/23/2012 12:55 PM, Jared Hall wrote:
> I think I have a simple question about how Zope is handling requests.
> My current task is to understand an already-written Zope web
> application.
>
> One thing I can't wrap my head around is this URL:
>
> https://mysite.com/UserManagement/Users/asmithS/
>
> Speaking in Zope terms, the UserManagement object is contained in the
> top-level product. In the UserManagement object, there is a Users
> object. That's all fine and dandy, run of the mill,
> acquisition/containment. However, the Users object has no asmithS
> object. In fact, asmithS is just a username, which makes the last
> field in the URL essentially a parmeter on the Users object.
>
> From examining the behavior of the webapp and the code itself, I know
> that the index_html method of the Users object is what is returned
> from this request, which is a Page Template that displays the user
> information based on the parameter.
>
> All of what I've said so far could be wrong, so feel free to correct
> me if I've mis-spoken. The problem I have is that this asmithS guy
> seems magical. I can't figure out how the index_html knows to be
> called with the username as a parameter(obviously the index_html
> function doesn't explicitly require the parameter).
>
> What I BELIEVE is happening: the asmithS argument is processed before
> the page template renders. For example, when asmithS is given, a
> lookup is performed on the database that adds variables to the REQUEST
> object such as FirstName, LastName, etc. I can't find this happening
> but I think it must exist.
Check the code for your 'Users' object for one of the following methods:
- - '__bobo_traverse__'
- - '__getitem__'
I'm gueessing one of those is resposible for returning the object
corresponding to 'asmithS': that object is the "here" (context) for the
template.
Another (weirder) possibility is the '__before_publishing_traverse__'
method, which (if present) gets called when publishing traversal enters
an object: it can munge the request arbitrarily.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlANklkACgkQ+gerLs4ltQ6UhgCgps7jhPQDmXkCm8SYXC43sCE6
wzAAoNoZkjejtPs3pnPkXkrUexZ6czYN
=puKr
-----END PGP SIGNATURE-----
More information about the Zope
mailing list