Flash is show on my index page so the position <div 
class="flash">{{=session.flash 
or ''}}</div> is ok
I just put session.flash('Some random text') in my index function and it 
works

But after registration the message is not shown

My code for user registration in index.py user

if request.args(0) == 'register':

    #form = auth.register()
    if form.process().accepted:

        #some code

        session.flash = ('Thank you for registering. Please check your e-mail 
account')

        redirect(URL(request.application, 'default', 'index'))



On Sunday, May 7, 2017 at 3:18:16 PM UTC+2, Anthony wrote:
>
> Are you successfully able to show any flash messages (i.e., simply set 
> response.flash within any action and see if it shows up on the page)? Is 
> the appropriate DIV in the layout.html?
>
> Note, by the time you are in the index function, session.flash is not 
> expected to be there any longer, as the framework copies session.flash to 
> response.flash after a redirect. Is there anything in response.flash at 
> that point?
>
> Anthony
>
> On Sunday, May 7, 2017 at 5:25:17 AM UTC-4, Yebach wrote:
>>
>> Hello
>>
>> After redirecting user after registriation the flash message is not 
>> shown. if I print session the message gets lost --> flash is none
>>
>> I inserted print session in my user function in default.py controller and 
>> in index function
>>
>> This is the print result
>>
>> <Storage {'flash': 'Thank you for registering. Please check your e-mail 
>> account', '_formkey[register]': ['cd76b587-db09-46fa-a05e-b31c2f71d4c4', 
>> 'ad7148b5-3306-455b-9c2d-65e6c91e9856', 
>> '069640cf-0c68-416c-b091-8e8efa337e24', 
>> 'd89158de-86a5-4e23-9a07-43ba042a09ac', 
>> 'fa1a99ba-8d97-49c2-ad0d-ffe7ba66e412', 
>> '5cfb4a89-8284-4879-9b1d-9bc923350771', 
>> '6b55ba7d-fa6f-4709-a8ca-0ec30e4f4455', 
>> 'c983f92b-10d6-47d7-b02f-a5bc7a4419b4', 
>> '7ff1a289-f9b4-47b6-92a2-da93fcdeb8ca', 
>> 'c298cda9-447b-47e4-b9b5-7b1a6f85645d'], '_formkey[login]': 
>> ['dc014554-b3a9-4ab7-8a4e-21600922d485', 
>> '4afe46f2-77a8-4e74-abc9-1d2d512a1d56', 
>> '3fa4d78a-4113-419f-ae90-5a39d3bac9f9', 
>> '171e7853-0f31-4e66-b8ef-1c8c665610b5', 
>> '86b76af0-3f51-4f47-95e6-903a117db2cb', 
>> 'f117d59d-7e38-4e90-a70c-fb9f507b3681', 
>> '756458fd-1f13-4aab-9f71-fae5322199c5', 
>> 'e5949f3d-3094-45f2-94ba-ff4c9ea27d08', 
>> '8abea09c-9493-499b-bf50-5487262a9a03', 
>> '467f8079-508a-4c83-bbf1-49ba86ade0f1'], '_formkey[auth_user/create]': 
>> ['5cf42aee-c3b1-4f2b-a4b5-6027ec55c7c3', 
>> '6a58a734-dc76-43b0-84df-fc35444a6364', 
>> '0cc70146-e946-411c-9ced-4552098a07c8', 
>> 'b189dc4c-d789-463b-a223-ce22bb880828', 
>> '4ebe96ab-1b25-4bcf-98bd-285f51b28168', 
>> 'd5f15dea-51c4-446e-a66e-f3aaccc3937b', 
>> 'a13cf1fe-a994-44e0-b03c-c5769f0d0d92', 
>> '7297c942-159e-491f-9a63-fc10420c1ebb', 
>> 'dbe6e93c-28e0-4b54-b4d5-3a0f4083059d', 
>> '199b91db-8921-42a2-a741-1dd323c09600']}>
>>
>> session index  <Storage {'flash': None, '_formkey[register]': 
>> ['cd76b587-db09-46fa-a05e-b31c2f71d4c4', 
>> 'ad7148b5-3306-455b-9c2d-65e6c91e9856', 
>> '069640cf-0c68-416c-b091-8e8efa337e24', 
>> 'd89158de-86a5-4e23-9a07-43ba042a09ac', 
>> 'fa1a99ba-8d97-49c2-ad0d-ffe7ba66e412', 
>> '5cfb4a89-8284-4879-9b1d-9bc923350771', 
>> '6b55ba7d-fa6f-4709-a8ca-0ec30e4f4455', 
>> 'c983f92b-10d6-47d7-b02f-a5bc7a4419b4', 
>> '7ff1a289-f9b4-47b6-92a2-da93fcdeb8ca', 
>> 'c298cda9-447b-47e4-b9b5-7b1a6f85645d'], '_formkey[login]': 
>> ['dc014554-b3a9-4ab7-8a4e-21600922d485', 
>> '4afe46f2-77a8-4e74-abc9-1d2d512a1d56', 
>> '3fa4d78a-4113-419f-ae90-5a39d3bac9f9', 
>> '171e7853-0f31-4e66-b8ef-1c8c665610b5', 
>> '86b76af0-3f51-4f47-95e6-903a117db2cb', 
>> 'f117d59d-7e38-4e90-a70c-fb9f507b3681', 
>> '756458fd-1f13-4aab-9f71-fae5322199c5', 
>> 'e5949f3d-3094-45f2-94ba-ff4c9ea27d08', 
>> '8abea09c-9493-499b-bf50-5487262a9a03', 
>> '467f8079-508a-4c83-bbf1-49ba86ade0f1'], '_formkey[auth_user/create]': 
>> ['5cf42aee-c3b1-4f2b-a4b5-6027ec55c7c3', 
>> '6a58a734-dc76-43b0-84df-fc35444a6364', 
>> '0cc70146-e946-411c-9ced-4552098a07c8', 
>> 'b189dc4c-d789-463b-a223-ce22bb880828', 
>> '4ebe96ab-1b25-4bcf-98bd-285f51b28168', 
>> 'd5f15dea-51c4-446e-a66e-f3aaccc3937b', 
>> 'a13cf1fe-a994-44e0-b03c-c5769f0d0d92', 
>> '7297c942-159e-491f-9a63-fc10420c1ebb', 
>> 'dbe6e93c-28e0-4b54-b4d5-3a0f4083059d', 
>> '199b91db-8921-42a2-a741-1dd323c09600']}>
>>
>> session index  <Storage {'flash': None, '_formkey[register]': 
>> ['cd76b587-db09-46fa-a05e-b31c2f71d4c4', 
>> 'ad7148b5-3306-455b-9c2d-65e6c91e9856', 
>> '069640cf-0c68-416c-b091-8e8efa337e24', 
>> 'd89158de-86a5-4e23-9a07-43ba042a09ac', 
>> 'fa1a99ba-8d97-49c2-ad0d-ffe7ba66e412', 
>> '5cfb4a89-8284-4879-9b1d-9bc923350771', 
>> '6b55ba7d-fa6f-4709-a8ca-0ec30e4f4455', 
>> 'c983f92b-10d6-47d7-b02f-a5bc7a4419b4', 
>> '7ff1a289-f9b4-47b6-92a2-da93fcdeb8ca', 
>> 'c298cda9-447b-47e4-b9b5-7b1a6f85645d'], '_formkey[login]': 
>> ['dc014554-b3a9-4ab7-8a4e-21600922d485', 
>> '4afe46f2-77a8-4e74-abc9-1d2d512a1d56', 
>> '3fa4d78a-4113-419f-ae90-5a39d3bac9f9', 
>> '171e7853-0f31-4e66-b8ef-1c8c665610b5', 
>> '86b76af0-3f51-4f47-95e6-903a117db2cb', 
>> 'f117d59d-7e38-4e90-a70c-fb9f507b3681', 
>> '756458fd-1f13-4aab-9f71-fae5322199c5', 
>> 'e5949f3d-3094-45f2-94ba-ff4c9ea27d08', 
>> '8abea09c-9493-499b-bf50-5487262a9a03', 
>> '467f8079-508a-4c83-bbf1-49ba86ade0f1'], '_formkey[auth_user/create]': 
>> ['5cf42aee-c3b1-4f2b-a4b5-6027ec55c7c3', 
>> '6a58a734-dc76-43b0-84df-fc35444a6364', 
>> '0cc70146-e946-411c-9ced-4552098a07c8', 
>> 'b189dc4c-d789-463b-a223-ce22bb880828', 
>> '4ebe96ab-1b25-4bcf-98bd-285f51b28168', 
>> 'd5f15dea-51c4-446e-a66e-f3aaccc3937b', 
>> 'a13cf1fe-a994-44e0-b03c-c5769f0d0d92', 
>> '7297c942-159e-491f-9a63-fc10420c1ebb', 
>> 'dbe6e93c-28e0-4b54-b4d5-3a0f4083059d', 
>> '199b91db-8921-42a2-a741-1dd323c09600']}>
>>
>>
>> also when redirected to index.html the session is printed twice
>>
>> Any suggestions why this kind of behaviour?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to