[Twisted-web] Making a Page instance a proxy to another one

Michal Pasternak michal at pasternak.w.lub.pl
Sun Jun 20 21:20:39 MDT 2004


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. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040621/20164467/attachment.bin


More information about the Twisted-web mailing list