[Web-SIG] WSGI deployment part 2: factory API

Ian Bicking ianb at colorstudy.com
Mon Jul 25 04:33:53 CEST 2005


OK, so lets assume we have a way (entry points) to get an object that 
represents the package's WSGI application, as a factory.  What do we do 
with that factory?  That is, how do we make an application out of the 
factory?  Well, it seems rather obvious that we call the factory, so 
what do we pass?  Also, consider that there might be two separate but 
similar APIs, one for filters and another for applications.

We could go free-form, and you call application factories with keyword 
arguments that are dependent on the application.  This serves as 
configuration.  You can call filter factories with keyword arguments, 
and one special (required?) keyword argument "next_app".

Another option is we pass in a single dictionary that represents the 
entire configuration.  This leaves room to add more arguments later, 
where if we use keyword arguments for configuration then there's really 
no room at all (the entire signature of the factory is taken up by 
application-specific configuration).

Another part of the API that I can see as useful is passing in the 
distribution object itself.  This way a function in paste (or wherever) 
could serve as the loader for any application with the proper 
framework-specific metadata (and so probably this could devolve into 
per-framework loaders).  This would perhaps preclude non-setuptools 
factories, though you could also pass in None for the distribution for 
those cases.

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org


More information about the Web-SIG mailing list