[Twisted-web] Capturing args to the Registry

Sergio Trejo serj_trejo at hotmail.com
Sat Jul 24 12:57:32 MDT 2004

I am capturing cgi args to the registry (in a .rpy script) inside a 
resource's render_GET() method courtesy of registry.setComponent(). Once the 
resource has returned its html to the HTTP client, I want to parse out some 
of the cgi args and send them over the wire to a remote PB server.

Is there any way to extract the cgi args from the registry before my .rpy 
script dies? I've only been able to reclaim the stored args from the 
registry after a subsequent browser hit (I.e., using registry.getComponent() 
the next HTTP request that invokes render_GET() works). I'm hoping this will 
be simple, as I would prefer not to write to storage and would prefer to use 
the registry per every instance that the .rpy is loaded by the Twisted web 

Here's an example of what I've got:

class Poof:
	def __init__(self, a):
		self.arr = a
	def setArgs(self, a):
		self.arr = a
	def getArgs(self):
		return self.arr

class leResource(Resource):
	isLeaf = True

	def render_GET(self, request):
		p= Poof(request.args)
		registry.setComponent(Poof, p)
		return "<html>Thanks for your visit.</html>"

resource = leResource()

# get cgi args, send them over the wire to the PB server

Thanks much for any suggestions.


MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 

More information about the Twisted-web mailing list