I would have built a new session factory, that simply instantiates a 
SignedCookieSessionFactory and adds my defaults.

The only reason why I don’t think it’s a good idea is that it gets pickled and 
sent down to the client, you want to keep what you store in the session as 
small as possible to avoid sending extraneous data to and from the client.


> On Sep 6, 2015, at 21:35 , neRok <[email protected]> wrote:
> 
> Hi. I am using the SignedCookieSessionFactory, as I have very simple needs of 
> the session. I can't see a way to add default objects to the session, eg I 
> want the default/new session to be `{'pinned':OrderedDict()}`. This way in my 
> code, I don't need to be checking if 'pinned' is set, and setting it to an 
> OrderedDict otherwise. Doing so is extremely impractical in templates.
> 
> As a workaround, I have virtually copied pyramid.session, and altered 'class 
> CookieSession(dict)'. I changed the lines `state = {}` to `state = 
> self._state`, and set `_state = {'pinned':OrderedDict()}`. Is this as good as 
> it gets, or is there a hook or something I missed and could be using to set 
> my defaults better?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to