pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
501 stars 239 forks source link

Better `modified` detection #30

Closed deforestg closed 8 years ago

deforestg commented 8 years ago

recursively convert dicts into CallbackDicts to better detect when values are changed

deforestg commented 8 years ago

decided against this

fengsp commented 8 years ago

@deforestg Why? Performance?

deforestg commented 8 years ago

because I realized that it inherently modifies the data that is being stored in the session if it is a dict - so for instance if you have a line that says if type(session['thing']) is dict: then that will no longer work since its been converted to a CallbackDict instead

fengsp commented 8 years ago

@deforestg And it doesn't apply to other mutable objects like list, so modified detection is still a problem. Try to keep it simple, just do this:

data = session['key']
# modify data here
session['key'] = data