On 2 Jul 2007, at 19:48, Ian Bicking wrote:

> Ben Bangert wrote:
>> On Jul 2, 11:10 am, Ian Bicking <[EMAIL PROTECTED]> wrote:
>>>> And have multiple flashes keyed at once.
>>> That seems weird to me... what purpose does the key have?  Just  
>>> so you
>>> can clear the key with "flash['login_msg'] = None" ?
>>
>> No, clearing the flash is handled automatically during the next
>> request, you never clear the flash yourself (by design its around for
>> the next request only). The purpose of having a keyed one, is so that
>> multiple functions can easily store a little message without
>> overriding each other's message. Generally there's only one or two
>> flashes, and having them keyed makes it easy to avoid overwriting
>> another one, and store 2 or 3.
>
> OK, then that's just weird ;)  If it's a function/method like
> flash(message) then you just append that to a list of flashed  
> messages,
> and it works.  A meaningless key is just distracting.
>

The key value could become the class for the flash so that different  
flash messages could be styled differently based on the key (eg:  
"critical-alert", "warning", "info", etc).

I use this type of pattern quite often in my apps (using my own  
custom tg_flash).

Cheers,
Chris Miles


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to