Sorry but I have to say the {{if response.flash.xml()[1:4] == 'div':}}
looks ugly. I guess:
isinstance(response.flash, str)
or:
isinstance(response.flash,DIV)
would do same thing and is more elegant.
On Apr30, 2:58am, Fran <[email protected]> wrote:
> In order to use the newly-suggested differential flash classes (), I
> have this in my layout.html:
> {{if response.flash:}}
> {{if response.flash.xml()[1:4] == 'div':}}
> {{=response.flash}}
> {{else:}}
> <div class="confirmation">{{=response.flash}}</div>
> {{pass}}
> {{pass}}
>
> This allows me to use a straight 'response.flash' & have it styled as
> a 'confirmation' or else response.flash=DIV(T("Form
> invalid!"),_class="error") if I want other styles.
>
> However response.flash.xml() is broken in r161 onwards.
> Current error is:
> AttributeError: 'str' object has no attribute 'xml'
>
> I guess this is the new 'early-T' right?
> I remember seeing that a .xml() would break.
> Anything I can easily rewrite my layout.html to instead?
> (Not that breaking backwards compatibility is a good thing, but I do
> really appreciate efforts to make it easier to Internationalise)
>
> I guess I could just put back the old session hack so that
> response.error can be used as well as response.flash.
> - it's easier to for coders actually anyway.
> However I was trying to stay as close to web2py framework as possible
> to make upgrades/documentation easier.
>
> F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---