Pylons/webob — pull request #125 by bertjwregeer (2013-12-03 06:08:49+00:00)
Title: Feature: CookieProfile

This is a pull request for a quick port of the CookieHelper stuff from Pyramid to WebOb, along with the rename suggested by @mcdonc and the changes as discussed in: https://github.com/Pylons/pyramid/pull/1200

There is one major change from what was requested in that pull request discussion: CookieProfile is not necessarily a factory-factory, it can be used stand-alone so long as you don't try to call `get_value()`, since that requires that you have bound a `Request` object to it first. This currently raises `ValueError` this needs to be improved. You can use it as a factory-factory though and it will simply make a copy of itself, and bind the `Request` object, improvements can be made here I think ...

I have added `SignedSerializer` and `JsonSerializer`, JSON by default on Python 3.x won't load from `byte` strings, so there are a few conversions to `native` where required, and vice-versa, however I have a feeling that this won't play well with Pickle, I am not sure what to do here. This compatibility stuff is hard.

Speaking of compatibility, tests don't pass on Python 3.2 and 3.3. It has something do with the `__repr__` method on the Morsel and it being unable to find it's `self.name`. I am not familiar enough with slots or how that entire method even works/fits together so I don't know how to fix it. Please help!

SignedCookieProfile has also been created...

The wild-domain/parent-domain/domain only logic stuff has been removed entirely. If you don't set a domain no domain will be set by default. You have to either explicitly set domains equal to an iterable (tuple, list, what have you) upon instantiating the object or set the domains when you are calling `get_headers` and `set_cookies`.

Thanks,
Bert