webpy/webpy — pull request #161 by shish (2012-06-28 11:45:41+00:00)
Title: Only store new session data if the data is non-default

Forcing every person (and web crawler) who visits the site to have a unique cookie means that every page is unique, and thus un-cacheable. Also, Googlebot crawling my site results in millions of sessions clogging the database, that all contain default data.

I've made a small change to web/session.py:Session._save so that it only stores sessions and sets cookies if the data is different from the initializer - with that done, I can now stick Varnish in front of the site, and it correctly serves cached pages to anonymous browsers and dynamic pages to logged-in users, drastically reducing the load.

(This is a pull-request version of #158, as requested)