()
Save any changed session data.
Save any changed session data.
Save any changed session data .
def save():
    """Save any changed session data."""

    if not hasattr(cherrypy.serving, 'session'):
        return
    request = cherrypy.serving.request
    response = cherrypy.serving.response

    # Guard against running twice
    if hasattr(request, '_sessionsaved'):
        return
    request._sessionsaved = True

    if response.stream:
        # If the body is being streamed, we have to save the data
        #   *after* the response has been written out
        request.hooks.attach('on_end_request', cherrypy.session.save)
    else:
        # If the body is not being streamed, we save the data now
        # (so we can release the lock).
        if is_iterator(response.body):
            response.collapse_body()
        cherrypy.session.save()
def save ( ) : if not hasattr ( cherrypy . serving , 'session' ) : return request = cherrypy . serving . request response = cherrypy . serving . response # Guard against running twice if hasattr ( request , '_sessionsaved' ) : return request . _sessionsaved = True if response . stream : # If the body is being streamed, we have to save the data #   *after* the response has been written out request . hooks . attach ( 'on_end_request' , cherrypy . session . save ) else : # If the body is not being streamed, we save the data now # (so we can release the lock). if is_iterator ( response . body ) : response . collapse_body ( ) cherrypy . session . save ( )