Closed advh67 closed 3 years ago
@advh67 a couple of things:
response.alerts()
will remove messages, so calling it several times in the same request flow won't give the same resultsThe sessions implementation in app.pipeline is: [SessionManager.cookies('mykey'),...]
I put a second response.alerts() to check if It become an empty list. The emmett function helpers.get_flashed_messages() is working. If I comment out the
alerts={{=current.response.alerts()}}
the result is the same, the value of current.session['_flashes'] in the template becomes [] after reading with response.alerts().
The key '_flashes' contains an empty list but the main 'session' does not seem to update the changes, keeping the '_flashes' list intact.
Adding prints in my pipeline:
class MyAuthPipe(Pipe):
.... code
async def close(self):
print('session.close:')
print(self.auth.session)
print('----------------')
shows in my linux terminal:
session.close:
<sdict {'_flashes': [('message', 'Session finished'), ('message', 'Welcome, advh67')], 'auth': <sdict {'user': 'advh67', 'data': {'first_name': 'advh67'}, 'last_visit': datetime.datetime(2020, 11, 5, 7, 24, 48, 602188), 'last_dbcheck': datetime.datetime(2020, 11, 5, 7, 24, 48, 602188), 'expiration': 2592000, 'remember': False}>}>
The "Session finished" message coming from previous logout page does not get erased, neither the "Welcome User" one. Any session['newsessionkey'] value set into the template is shown at the page, but never got updated in the "true" session.
@advh67 I confirm this, is a side effect of a flow change I made between 2.0 and 2.1 I should be able to publish a 2.1.3 in the next 48 hours, I'm sorry for the inconvenient.
Nice.
Thanks
This is fixed both in master and 2.1.3
🎉
At the controller python file:
flash('Welcome, advh67')
My template file "include_flash.html":
This code works well, at first sight:
The "session" values in template looks updated, but the session variable in main code does not get updated. The '_flashes' value is not emptyed and shows the same messages at every page refresh. The 'newsessionkey' becomes inexistent, too. This code worked in emmett 2.0.2