Making a Page instance a proxy to another one

Hi, I need to have a Page instance to work as a proxy to another one - so url "somesite/somepage/child1" will return not "child1" of "somepage", but "child1" of "someOtherPage". What's the easiest and most correct method to do that? I've had some partial success with getDynamicChild: def child_(self, req): return self.getDynamicChild("", req) def getDynamicChild(self, name, req): if name="": return self.proxyPage else: return maybeDeferred(self.proxyPage.locateChild, [name], req).addCallback(lambda x: x[0]) ... basically, this works okay for child_* methods in proxyPage, but gives wrong results for formless child mixins (I haven't tested proxyPage.getDynamicChild). I cannot just replicate child_ methods of proxyPage in Page, because I have no idea, what child methods proxyPage has (it's a dynamically generated page instance). Help! :^) -- Michal Pasternak :: http://pasternak.w.lub.pl :: http://winsrc.sf.net "Frankly, any company would look bad if their corporate e-mail was available for anyone to read," -- Jim Dose of Ritual Entertainment.

Michal Pasternak [Mon, Jun 21, 2004 at 05:20:39AM +0200]:
def child_(self, req): return self.getDynamicChild("", req)
def getDynamicChild(self, name, req): if name="": return self.proxyPage else: return maybeDeferred(self.proxyPage.locateChild, [name], req).addCallback(lambda x: x[0])
... basically, this works okay for child_* methods in proxyPage, but gives wrong results for formless child mixins (I haven't tested proxyPage.getDynamicChild).
Well, that behaviour was caused by broken locateChild, fixed in rev. 346. Anyway, even if that works, I still look forward for any better methods :) -- m
participants (1)
-
Michal Pasternak