Pylons / pyramid

Pyramid - A Python web framework
https://trypyramid.com/
Other
3.97k stars 887 forks source link

add optional scope to `ISession.changed()` #3671

Closed gjo closed 2 years ago

gjo commented 3 years ago

I'd like to create an ISession implementation that persists session data, split by key. In the current interface, when ISession.changed() is called, all the data will be persisted. If we can get the key that was changed during ISession.changed(), we can narrow down the scope of persistence.

mmerickel commented 3 years ago

I don't see a need to change the ISession contract to handle this. The Session impl should be able to detect which keys changed internally most of the time. Remember a Session impl can invoke any other methods it wants internally when it detects keys change (and even support optional args on the .changed method.

This API only needs to be used by app developers consuming the session - and I'm not convinced they need the current .changed() api very often, let alone a more granular version of it.

mmerickel commented 2 years ago

Considering my comments above and also the fact that you can implement this feature on your session implementation without adding it to the interface at this time I'm going to close this. Apologies for not accepting this but thank you for trying to contribute your work!