Suggestion: `Session` panel
I wrote a custom variation of this idea and wanted to suggest it upstream after seeing the 4.1 announcement
We split sessions into a separate panel so that the data can be captured BEFORE and AFTER the request is processed, then show the info side-by-side on a table. I forget where the toolbar currently captures data, but it's only one.
Right now we snapshot the session upon first access. Tracking its updated state and visualizing the changes sounds nice.
It's a lifesaver. We don't use Pyramid's stock sessions, so my panel is incompatible as-is. I don't know when I'll have time to port, but will try to.
If anyone wants to tackle it before I get to this, this is generally what we have running:
in our panel sessions.py:
class SessionDebugPanel(DebugPanel):
# we need the request in the response phase
__request = None
def __init__(self, request):
self.__request = request # stash for response
self.data = data = {'session_request': None,
'session_response': None,
}
_request_attrs = request.__dict__.copy()
if 'session' in _request_attrs:
data.update({'session_request': _request_attrs['session']}
def process_response(self, response):
_request_attrs = self.__request.__dict__.copy()
if 'session' in _request_attrs:
data.update({'session_response': _request_attrs['session']}
the display html just creates a table of all the keys present in both, then iterates them as:
<tr><th>key</th>
<td>request</td>
<td>response</td>
</tr>