user3283690 answer gave me the idea that setting the message to the empty string was all that was needed to stop the flash message from showing. This makes sense because the following line in layout.html:
<div class="flash">{{=response.flash or ''}}</div>
Looking at the Auth
class in [web2py-root-directory]/gluon/tools.py I saw there was dictionary called default_messages
with entries for logged_in
and logged_out
. So I tried setting the following in db.py:
auth.messages.logged_in = None
auth.messages.logged_out = None
And it worked