Sylvain Hellegouarch wrote: > Personally, I would favor the idea that WSGI2 specifies the way headers > should be mapped to object attributes (e.g. Content-Type would become > content_type) and then let duck typing magic happen rather than > specifying a class from which to inherit for instance.
How would you handle HTTP extension headers like X-MyEnterprise-Metadata? Cook [1] might be appropriate to read here: "...abstract data types facilitate adding new operations, while [objects] facilitate adding new representations... Abstract data types define operations that collect together the behaviors for a given action. Objects organize the matrix the other way, collecting together all the actions associated with a given representation. It is easier to add new operations in an ADT, and new representations using objects." IMO, it's quite appropriate that we essentially use an ADT (a dict) at the lowest level, precisely because it constrains the representation. This is the essence of The Zen of CherryPy #8 "Subclassed builtins are better than custom types" (really, custom _classes_) and #9 "But builtin types are even better". People can then objectify those ADTs to their representational taste. Robert Brewer fuman...@aminus.org [1] http://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf [2] http://www.cherrypy.org/wiki/ZenOfCherryPy#a8.Subclassedbuiltinsarebette rthancustomtypes. _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com