16 Sep
2003
16 Sep
'03
6:18 p.m.
nwingfield@che-llp.com wrote at 2003-9-15 14:38 -0400:
... Q2. In product code, what is the value in using 'self.restrictedTraverse(id)' or 'self.unrestrictedTraverse(id)' versus simpler notation, such as 'self[id]' or 'getattr(self, id)' ?
In addition, what others already said: [un]restrictedTraverse is very similar to how ZPublisher traverses the object hierarchy along the URL. Especially, it uses "__bobo_traverse__" when it is defined. If "__bobo_traverse__" is not defined and "getattr" cannot resolve "id", it uses "getitem" (if it is available). "restrictedTraverse" is what TALES "path" expressions use. Dieter