[Web-SIG] middleware example

Ian Bicking ianb at colorstudy.com
Fri Nov 19 05:50:58 CET 2004


Terrel Shumway wrote:
>> Or maybe we need to find other middleware examples besides 
>> authentication and session handling, which are the two things most 
>> often "pre-decided" with many servers and almost any web programming 
>> framework in any language (because they're such a pain). Maybe they 
>> are special cases that need to be considered separately anyway?
>>
> 
> This is a special case of authentication and sessions:
> 
> I have an app that runs in http://myserver.dom/
> I have a shopping cart that needs to collect
> payment information through a secure connection
> https://secure.server.dom/cgi-bin/order
> 
> I want the payment page to match the look and feel
> of the unsecured site, so I make the templates
> available on the secure site. Now: How do I choose
> which set of templates to use?
> 
> 1. The merchant passes a cookie to the secure site
> 2. The middleware decodes the cookie and adds the
>  appropriate merchant-specific directory to the
>  template search path
>   e.g. env["cheetah.templatepath"].insert(0,merchantdir)

This is definitely a good example of a place where it will help if the 
configuration is stored in the WSGI environment.  If you used static 
configuration, you wouldn't be able to modify this on a per-request 
basis.  Of course, you could put the dynamicism in elsewhere, but I 
think it will be better allowed for if it's part of the request.

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


More information about the Web-SIG mailing list