[Twisted-web] confusion with general web serving

Jonathan Vanasco twisted-python at 2xlp.com
Tue Apr 17 09:57:24 CDT 2007


I asked this on the -python list, some suggested I re-ask here.

I'm trying to build a small daemon that does the following:

	1_ parse the uri for the key to an image
	2_ validate that key against db
		3_ if not valid, render a 404
		4_ if valid, map to an arbitrary file on the fs  ( pulled from db )
		4b_ or check a bdb to see if its on the fs, pull a copy off of  
amazon's s3 otherwise and update the cachedb to note we have it

The issue that I'm having:

	i originally tried doing this based on one of the chapters in the  
twisted o'reilley book.  i ran into issues when I tried to render an  
image -- i couldn't figure out how to do that.

	somone on twisted web suggested i not use the protocol and instead  
use site (http://twistedmatrix.com/projects/web/documentation/howto/ 
using-twistedweb.html#auto2 ).   i ran into issues when trying to  
render status codes and add in proxy functionality.


I'm at a loss on what I should be using.  can someone offer advice ?




== oreilley style ==
class UserphotoRequestHandler(http.Request):
	def process(self):
		pass

class UserphotoHttp(http.HTTPChannel):
	requestFactory = UserphotoRequestHandler

class UserphotoHttpFactory(http.HTTPFactory):
	protocol= UserphotoHttp

if __name__ == "__main__":
	from twisted.internet import reactor
	reactor.listenTCP(7087, UserphotoHttpFactory())
	reactor.run( )


	


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





More information about the Twisted-web mailing list