[Zope] Problem Understanding URL
Jared Hall
JHall at riverainc.com
Mon Jul 23 19:01:46 UTC 2012
Ok I'd read about those functions a little bit in the Zope 2 book or the Developer's Guide, but they seemed like advanced techniques that I probably wouldn't need to understand.
Back on topic; I ran this awesome command in the terminal:
grep getitem x=$(find . *.*)
and turned up some random references to getitem in some dtml code, which I judge to be insignificant. There was also one very interesting usage of __getitem__ in the python code itself, and I have to investigate the code further to understand what's going on. The function definition looks suspiciously like what I would expect to find for this 'hijacking' of control:
def __getitem__(self, key):
v=self._getOb(key, None)
if v is not None: return v
if hasattr(self, 'REQUEST'):
request=self.REQUEST
method=request.get('REQUEST_METHOD', 'GET')
if request.maybe_webdav_client and not method in ('GET', 'POST'):
return NullResource(self, key, request).__of__(self)
raise KeyError, key
I read this as: look up the object in the current context and return it. The only problem with this is that I don't see when the object gets placed into the proper context for the TAL statements like here/FirstName, etc.
Thanks for your help already, and any continued guidance is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/zope/attachments/20120723/86edd47c/attachment.html>
More information about the Zope
mailing list