I have been struggling with the flash messages as well. At the moment I 
have a separate view flash.html:

{{if response.flash:}}
  <div class=" alert {{if 
alert:}}{{=alert}}{{else:}}{{alert-info}}{{pass}}">
    <a class="close" data-dismiss="alert">x</a>
    {{=response.flash}}
  </div> <!-- /alert -->
{{pass}}

In this view I use Bootstrap's alerts to style the flash messages. 
'alert-info' is the one I use most, in case I need another alert set it in 
the function:

def index():
    ...
    if form.process().accepted:
        ...
        alert='alert-success'
    elif form.errors:
        alert='alert-error'
    else:
        ...
   return dict(alert=alert, ...)

In my views I simply include {{include 'flash.html'}}

This works for now, to come up with a more sophisticated way to set the 
alerts is on my to do list.


Annet

Reply via email to